diff options
Diffstat (limited to 'roff.c')
-rw-r--r-- | roff.c | 256 |
1 files changed, 128 insertions, 128 deletions
@@ -785,17 +785,17 @@ roffhash_find(const char *p, size_t s) */ if (p[0] < ASCII_LO || p[0] > ASCII_HI) - return(ROFF_MAX); + return ROFF_MAX; buc = ROFF_HASH(p); if (NULL == (n = hash[buc])) - return(ROFF_MAX); + return ROFF_MAX; for ( ; n; n = n->next) if (0 == strncmp(n->name, p, s) && '\0' == n->name[(int)s]) - return((enum rofft)(n - roffs)); + return (enum rofft)(n - roffs); - return(ROFF_MAX); + return ROFF_MAX; } /* --- stack of request blocks -------------------------------------------- */ @@ -914,7 +914,7 @@ roff_alloc(struct mparse *parse, const struct mchars *mchars, int options) roffhash_init(); - return(r); + return r; } /* --- syntax tree state data management ---------------------------------- */ @@ -977,7 +977,7 @@ roff_man_alloc(struct roff *roff, struct mparse *parse, man->defos = defos; man->quick = quick; roff_man_alloc1(man); - return(man); + return man; } /* --- syntax tree handling ----------------------------------------------- */ @@ -1003,7 +1003,7 @@ roff_node_alloc(struct roff_man *man, int line, int pos, n->flags |= MDOC_LINE; man->flags &= ~MDOC_NEWLINE; - return(n); + return n; } void @@ -1117,7 +1117,7 @@ roff_block_alloc(struct roff_man *man, int line, int pos, int tok) n = roff_node_alloc(man, line, pos, ROFFT_BLOCK, tok); roff_node_append(man, n); man->next = ROFF_NEXT_CHILD; - return(n); + return n; } struct roff_node * @@ -1128,7 +1128,7 @@ roff_head_alloc(struct roff_man *man, int line, int pos, int tok) n = roff_node_alloc(man, line, pos, ROFFT_HEAD, tok); roff_node_append(man, n); man->next = ROFF_NEXT_CHILD; - return(n); + return n; } struct roff_node * @@ -1139,7 +1139,7 @@ roff_body_alloc(struct roff_man *man, int line, int pos, int tok) n = roff_node_alloc(man, line, pos, ROFFT_BODY, tok); roff_node_append(man, n); man->next = ROFF_NEXT_CHILD; - return(n); + return n; } void @@ -1356,7 +1356,7 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos) if (EXPAND_LIMIT < ++expand_count) { mandoc_msg(MANDOCERR_ROFFLOOP, r->parse, ln, (int)(stesc - buf->buf), NULL); - return(ROFF_IGN); + return ROFF_IGN; } /* @@ -1463,7 +1463,7 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos) } else if (buf->sz + strlen(res) > SHRT_MAX) { mandoc_msg(MANDOCERR_ROFFLOOP, r->parse, ln, (int)(stesc - buf->buf), NULL); - return(ROFF_IGN); + return ROFF_IGN; } /* Replace the escape sequence by the string. */ @@ -1479,7 +1479,7 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos) free(buf->buf); buf->buf = nbuf; } - return(ROFF_CONT); + return ROFF_CONT; } /* @@ -1504,7 +1504,7 @@ roff_parsetext(struct buf *buf, int pos, int *offs) *offs = 0; free(roffit_macro); roffit_lines = 0; - return(ROFF_REPARSE); + return ROFF_REPARSE; } else if (roffit_lines > 1) --roffit_lines; @@ -1538,7 +1538,7 @@ roff_parsetext(struct buf *buf, int pos, int *offs) *p = ASCII_HYPH; p++; } - return(ROFF_CONT); + return ROFF_CONT; } enum rofferr @@ -1560,7 +1560,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) (r->eqn == NULL || r->eqn_inline)) { e = roff_eqndelim(r, buf, pos); if (e == ROFF_REPARSE) - return(e); + return e; assert(e == ROFF_CONT); } @@ -1568,7 +1568,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) e = roff_res(r, buf, ln, pos); if (e == ROFF_IGN) - return(e); + return e; assert(e == ROFF_CONT); ctl = roff_getcontrol(r, buf->buf, &pos); @@ -1587,23 +1587,23 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) e = (*roffs[t].text)(r, t, buf, ln, pos, pos, offs); assert(e == ROFF_IGN || e == ROFF_CONT); if (e != ROFF_CONT) - return(e); + return e; } if (r->eqn != NULL) - return(eqn_read(&r->eqn, ln, buf->buf, ppos, offs)); + return eqn_read(&r->eqn, ln, buf->buf, ppos, offs); if (r->tbl != NULL && ( ! ctl || buf->buf[pos] == '\0')) - return(tbl_read(r->tbl, ln, buf->buf, ppos)); + return tbl_read(r->tbl, ln, buf->buf, ppos); if ( ! ctl) - return(roff_parsetext(buf, pos, offs)); + return roff_parsetext(buf, pos, offs); /* Skip empty request lines. */ if (buf->buf[pos] == '"') { mandoc_msg(MANDOCERR_COMMENT_BAD, r->parse, ln, pos, NULL); - return(ROFF_IGN); + return ROFF_IGN; } else if (buf->buf[pos] == '\0') - return(ROFF_IGN); + return ROFF_IGN; /* * If a scope is open, go to the child handler for that macro, @@ -1614,7 +1614,7 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) if (r->last) { t = r->last->tok; assert(roffs[t].sub); - return((*roffs[t].sub)(r, t, buf, ln, ppos, pos, offs)); + return (*roffs[t].sub)(r, t, buf, ln, ppos, pos, offs); } /* No scope is open. This is a new request or macro. */ @@ -1628,12 +1628,12 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) mandoc_msg(MANDOCERR_TBLMACRO, r->parse, ln, pos, buf->buf + spos); if (t == ROFF_TS) - return(ROFF_IGN); + return ROFF_IGN; while (buf->buf[pos] != '\0' && buf->buf[pos] != ' ') pos++; while (buf->buf[pos] != '\0' && buf->buf[pos] == ' ') pos++; - return(tbl_read(r->tbl, ln, buf->buf, pos)); + return tbl_read(r->tbl, ln, buf->buf, pos); } /* @@ -1642,12 +1642,12 @@ roff_parseln(struct roff *r, int ln, struct buf *buf, int *offs) */ if (t == ROFF_MAX) - return(ROFF_CONT); + return ROFF_CONT; /* Execute a roff request or a user defined macro. */ assert(roffs[t].proc); - return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs)); + return (*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs); } void @@ -1687,7 +1687,7 @@ roff_parse(struct roff *r, char *buf, int *pos, int ln, int ppos) cp = buf + *pos; if ('\0' == *cp || '"' == *cp || '\t' == *cp || ' ' == *cp) - return(ROFF_MAX); + return ROFF_MAX; mac = cp; maclen = roff_getname(r, &cp, ln, ppos); @@ -1698,7 +1698,7 @@ roff_parse(struct roff *r, char *buf, int *pos, int ln, int ppos) if (ROFF_MAX != t) *pos = cp - buf; - return(t); + return t; } /* --- handling of request blocks ----------------------------------------- */ @@ -1715,7 +1715,7 @@ roff_cblock(ROFF_ARGS) if (r->last == NULL) { mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, ".."); - return(ROFF_IGN); + return ROFF_IGN; } switch (r->last->tok) { @@ -1734,7 +1734,7 @@ roff_cblock(ROFF_ARGS) default: mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, ".."); - return(ROFF_IGN); + return ROFF_IGN; } if (buf->buf[pos] != '\0') @@ -1743,7 +1743,7 @@ roff_cblock(ROFF_ARGS) roffnode_pop(r); roffnode_cleanscope(r); - return(ROFF_IGN); + return ROFF_IGN; } @@ -1838,7 +1838,7 @@ roff_block(ROFF_ARGS) if (namesz == 0 && tok != ROFF_ig) { mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ln, ppos, roffs[tok].name); - return(ROFF_IGN); + return ROFF_IGN; } roffnode_push(r, tok, name, ln, ppos); @@ -1853,7 +1853,7 @@ roff_block(ROFF_ARGS) roff_setstrn(&r->strtab, name, namesz, "", 0, 0); if (*cp == '\0') - return(ROFF_IGN); + return ROFF_IGN; /* Get the custom end marker. */ @@ -1880,7 +1880,7 @@ roff_block(ROFF_ARGS) mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse, ln, pos, ".%s ... %s", roffs[tok].name, cp); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -1916,8 +1916,8 @@ roff_block_sub(ROFF_ARGS) pos = i; if (roff_parse(r, buf->buf, &pos, ln, ppos) != ROFF_MAX) - return(ROFF_RERUN); - return(ROFF_IGN); + return ROFF_RERUN; + return ROFF_IGN; } } @@ -1931,11 +1931,11 @@ roff_block_sub(ROFF_ARGS) if (t != ROFF_cblock) { if (tok != ROFF_ig) roff_setstr(r, r->last->name, buf->buf + ppos, 2); - return(ROFF_IGN); + return ROFF_IGN; } assert(roffs[t].proc); - return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs)); + return (*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs); } static enum rofferr @@ -1945,7 +1945,7 @@ roff_block_text(ROFF_ARGS) if (tok != ROFF_ig) roff_setstr(r, r->last->name, buf->buf + pos, 2); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -1967,7 +1967,7 @@ roff_cond_sub(ROFF_ARGS) if ((t != ROFF_MAX) && (rr || roffs[t].flags & ROFFMAC_STRUCT)) { assert(roffs[t].proc); - return((*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs)); + return (*roffs[t].proc)(r, t, buf, ln, ppos, pos, offs); } /* @@ -1989,7 +1989,7 @@ roff_cond_sub(ROFF_ARGS) if (*ep != '\0') ++ep; } - return(rr ? ROFF_CONT : ROFF_IGN); + return rr ? ROFF_CONT : ROFF_IGN; } static enum rofferr @@ -2010,7 +2010,7 @@ roff_cond_text(ROFF_ARGS) if (*ep != '\0') ++ep; } - return(rr ? ROFF_CONT : ROFF_IGN); + return rr ? ROFF_CONT : ROFF_IGN; } /* --- handling of numeric and conditional expressions -------------------- */ @@ -2086,7 +2086,7 @@ roff_getnum(const char *v, int *pos, int *res, int flags) *res = scaled; *pos = p + 1; - return(1); + return 1; } /* @@ -2129,7 +2129,7 @@ out: else if (*s3 != '\0') s3++; *pos = s3 - v; - return(match); + return match; } /* @@ -2151,12 +2151,12 @@ roff_evalcond(struct roff *r, int ln, char *v, int *pos) switch (v[*pos]) { case '\0': - return(0); + return 0; case 'n': /* FALLTHROUGH */ case 'o': (*pos)++; - return(wanttrue); + return wanttrue; case 'c': /* FALLTHROUGH */ case 'd': @@ -2167,30 +2167,30 @@ roff_evalcond(struct roff *r, int ln, char *v, int *pos) /* FALLTHROUGH */ case 'v': (*pos)++; - return(!wanttrue); + return !wanttrue; case 'r': cp = name = v + ++*pos; sz = roff_getname(r, &cp, ln, *pos); *pos = cp - v; - return((sz && roff_hasregn(r, name, sz)) == wanttrue); + return (sz && roff_hasregn(r, name, sz)) == wanttrue; default: break; } savepos = *pos; if (roff_evalnum(r, ln, v, pos, &number, ROFFNUM_SCALE)) - return((number > 0) == wanttrue); + return (number > 0) == wanttrue; else if (*pos == savepos) - return(roff_evalstrcond(v, pos) == wanttrue); + return roff_evalstrcond(v, pos) == wanttrue; else - return (0); + return 0; } static enum rofferr roff_line_ignore(ROFF_ARGS) { - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2199,7 +2199,7 @@ roff_insec(ROFF_ARGS) mandoc_msg(MANDOCERR_REQ_INSEC, r->parse, ln, ppos, roffs[tok].name); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2208,7 +2208,7 @@ roff_unsupp(ROFF_ARGS) mandoc_msg(MANDOCERR_REQ_UNSUPP, r->parse, ln, ppos, roffs[tok].name); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2286,7 +2286,7 @@ roff_cond(ROFF_ARGS) out: *offs = pos; - return(ROFF_RERUN); + return ROFF_RERUN; } static enum rofferr @@ -2311,11 +2311,11 @@ roff_ds(ROFF_ARGS) name = string = buf->buf + pos; if (*name == '\0') - return(ROFF_IGN); + return ROFF_IGN; namesz = roff_getname(r, &string, ln, pos); if (name[namesz] == '\\') - return(ROFF_IGN); + return ROFF_IGN; /* Read past the initial double-quote, if any. */ if (*string == '"') @@ -2324,7 +2324,7 @@ roff_ds(ROFF_ARGS) /* The rest is the value. */ roff_setstrn(&r->strtab, name, namesz, string, strlen(string), ROFF_as == tok); - return(ROFF_IGN); + return ROFF_IGN; } /* @@ -2390,11 +2390,11 @@ roff_getop(const char *v, int *pos, char *res) (*pos)++; break; default: - return(0); + return 0; } (*pos)++; - return(*res); + return *res; } /* @@ -2407,11 +2407,11 @@ roff_evalpar(struct roff *r, int ln, { if ('(' != v[*pos]) - return(roff_getnum(v, pos, res, flags)); + return roff_getnum(v, pos, res, flags); (*pos)++; if ( ! roff_evalnum(r, ln, v, pos, res, flags | ROFFNUM_WHITE)) - return(0); + return 0; /* * Omission of the closing parenthesis @@ -2422,9 +2422,9 @@ roff_evalpar(struct roff *r, int ln, if (')' == v[*pos]) (*pos)++; else if (NULL == res) - return(0); + return 0; - return(1); + return 1; } /* @@ -2448,7 +2448,7 @@ roff_evalnum(struct roff *r, int ln, const char *v, (*pos)++; if ( ! roff_evalpar(r, ln, v, pos, res, flags)) - return(0); + return 0; while (1) { if (flags & ROFFNUM_WHITE) @@ -2463,7 +2463,7 @@ roff_evalnum(struct roff *r, int ln, const char *v, (*pos)++; if ( ! roff_evalpar(r, ln, v, pos, &operand2, flags)) - return(0); + return 0; if (flags & ROFFNUM_WHITE) while (isspace((unsigned char)v[*pos])) @@ -2536,7 +2536,7 @@ roff_evalnum(struct roff *r, int ln, const char *v, abort(); } } - return(1); + return 1; } /* --- register management ------------------------------------------------ */ @@ -2582,21 +2582,21 @@ roff_getregro(const struct roff *r, const char *name) switch (*name) { case '$': /* Number of arguments of the last macro evaluated. */ - return(r->argc); + return r->argc; case 'A': /* ASCII approximation mode is always off. */ - return(0); + return 0; case 'g': /* Groff compatibility mode is always on. */ - return(1); + return 1; case 'H': /* Fixed horizontal resolution. */ - return (24); + return 24; case 'j': /* Always adjust left margin only. */ - return(0); + return 0; case 'T': /* Some output device is always defined. */ - return(1); + return 1; case 'V': /* Fixed vertical resolution. */ - return (40); + return 40; default: - return (-1); + return -1; } } @@ -2609,14 +2609,14 @@ roff_getreg(const struct roff *r, const char *name) if ('.' == name[0] && '\0' != name[1] && '\0' == name[2]) { val = roff_getregro(r, name + 1); if (-1 != val) - return (val); + return val; } for (reg = r->regtab; reg; reg = reg->next) if (0 == strcmp(name, reg->key.p)) - return(reg->val); + return reg->val; - return(0); + return 0; } static int @@ -2628,15 +2628,15 @@ roff_getregn(const struct roff *r, const char *name, size_t len) if ('.' == name[0] && 2 == len) { val = roff_getregro(r, name + 1); if (-1 != val) - return (val); + return val; } for (reg = r->regtab; reg; reg = reg->next) if (len == reg->key.sz && 0 == strncmp(name, reg->key.p, len)) - return(reg->val); + return reg->val; - return(0); + return 0; } static int @@ -2648,15 +2648,15 @@ roff_hasregn(const struct roff *r, const char *name, size_t len) if ('.' == name[0] && 2 == len) { val = roff_getregro(r, name + 1); if (-1 != val) - return(1); + return 1; } for (reg = r->regtab; reg; reg = reg->next) if (len == reg->key.sz && 0 == strncmp(name, reg->key.p, len)) - return(1); + return 1; - return(0); + return 0; } static void @@ -2682,11 +2682,11 @@ roff_nr(ROFF_ARGS) key = val = buf->buf + pos; if (*key == '\0') - return(ROFF_IGN); + return ROFF_IGN; keysz = roff_getname(r, &val, ln, pos); if (key[keysz] == '\\') - return(ROFF_IGN); + return ROFF_IGN; key[keysz] = '\0'; sign = *val; @@ -2696,7 +2696,7 @@ roff_nr(ROFF_ARGS) if (roff_evalnum(r, ln, val, NULL, &iv, ROFFNUM_SCALE)) roff_setreg(r, key, iv, sign); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2708,7 +2708,7 @@ roff_rr(ROFF_ARGS) name = cp = buf->buf + pos; if (*name == '\0') - return(ROFF_IGN); + return ROFF_IGN; namesz = roff_getname(r, &cp, ln, pos); name[namesz] = '\0'; @@ -2724,7 +2724,7 @@ roff_rr(ROFF_ARGS) free(reg->key.p); free(reg); } - return(ROFF_IGN); + return ROFF_IGN; } /* --- handler functions for roff requests -------------------------------- */ @@ -2744,7 +2744,7 @@ roff_rm(ROFF_ARGS) if (name[namesz] == '\\') break; } - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2757,7 +2757,7 @@ roff_it(ROFF_ARGS) if ( ! roff_evalnum(r, ln, buf->buf, &pos, &iv, 0)) { mandoc_msg(MANDOCERR_IT_NONUM, r->parse, ln, ppos, buf->buf + 1); - return(ROFF_IGN); + return ROFF_IGN; } while (isspace((unsigned char)buf->buf[pos])) @@ -2773,7 +2773,7 @@ roff_it(ROFF_ARGS) roffit_macro = mandoc_strdup(iv != 1 || strcmp(buf->buf + pos, "an-trap") ? buf->buf + pos : "br"); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2788,7 +2788,7 @@ roff_Dd(ROFF_ARGS) if (r->format == 0) r->format = MPARSE_MDOC; - return(ROFF_CONT); + return ROFF_CONT; } static enum rofferr @@ -2803,7 +2803,7 @@ roff_TH(ROFF_ARGS) if (r->format == 0) r->format = MPARSE_MAN; - return(ROFF_CONT); + return ROFF_CONT; } static enum rofferr @@ -2817,9 +2817,9 @@ roff_TE(ROFF_ARGS) free(buf->buf); buf->buf = mandoc_strdup(".sp"); buf->sz = 4; - return(ROFF_REPARSE); + return ROFF_REPARSE; } - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2832,7 +2832,7 @@ roff_T_(ROFF_ARGS) else tbl_restart(ppos, ln, r->tbl); - return(ROFF_IGN); + return ROFF_IGN; } /* @@ -2855,7 +2855,7 @@ roff_eqndelim(struct roff *r, struct buf *buf, int pos) cp2 = strchr(cp1, r->eqn == NULL ? r->last_eqn->odelim : r->last_eqn->cdelim); if (cp2 == NULL) - return(ROFF_CONT); + return ROFF_CONT; *cp2++ = '\0'; bef_pr = bef_nl = aft_nl = aft_pr = ""; @@ -2898,7 +2898,7 @@ roff_eqndelim(struct roff *r, struct buf *buf, int pos) /* Toggle the in-line state of the eqn subsystem. */ r->eqn_inline = r->eqn == NULL; - return(ROFF_REPARSE); + return ROFF_REPARSE; } static enum rofferr @@ -2923,7 +2923,7 @@ roff_EQ(ROFF_ARGS) mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse, ln, pos, ".EQ %s", buf->buf + pos); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2931,7 +2931,7 @@ roff_EN(ROFF_ARGS) { mandoc_msg(MANDOCERR_BLK_NOTOPEN, r->parse, ln, ppos, "EN"); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2953,7 +2953,7 @@ roff_TS(ROFF_ARGS) r->first_tbl = r->last_tbl = tbl; r->tbl = r->last_tbl = tbl; - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2961,7 +2961,7 @@ roff_brp(ROFF_ARGS) { buf->buf[pos - 1] = '\0'; - return(ROFF_CONT); + return ROFF_CONT; } static enum rofferr @@ -2978,7 +2978,7 @@ roff_cc(ROFF_ARGS) mandoc_vmsg(MANDOCERR_ARG_EXCESS, r->parse, ln, p - buf->buf, "cc ... %s", p); - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -2992,7 +2992,7 @@ roff_tr(ROFF_ARGS) if (*p == '\0') { mandoc_msg(MANDOCERR_REQ_EMPTY, r->parse, ln, ppos, "tr"); - return(ROFF_IGN); + return ROFF_IGN; } while (*p != '\0') { @@ -3004,7 +3004,7 @@ roff_tr(ROFF_ARGS) if (esc == ESCAPE_ERROR) { mandoc_msg(MANDOCERR_ESC_BAD, r->parse, ln, (int)(p - buf->buf), first); - return(ROFF_IGN); + return ROFF_IGN; } fsz = (size_t)(p - first); } @@ -3015,7 +3015,7 @@ roff_tr(ROFF_ARGS) if (esc == ESCAPE_ERROR) { mandoc_msg(MANDOCERR_ESC_BAD, r->parse, ln, (int)(p - buf->buf), second); - return(ROFF_IGN); + return ROFF_IGN; } ssz = (size_t)(p - second); } else if (*second == '\0') { @@ -3040,7 +3040,7 @@ roff_tr(ROFF_ARGS) r->xtab[(int)*first].sz = ssz; } - return(ROFF_IGN); + return ROFF_IGN; } static enum rofferr @@ -3066,11 +3066,11 @@ roff_so(ROFF_ARGS) free(buf->buf); buf->buf = cp; *offs = 0; - return(ROFF_REPARSE); + return ROFF_REPARSE; } *offs = pos; - return(ROFF_SO); + return ROFF_SO; } /* --- user defined strings and macros ------------------------------------ */ @@ -3198,8 +3198,8 @@ roff_userdef(ROFF_ARGS) buf->buf = n1; *offs = 0; - return(buf->sz > 1 && buf->buf[buf->sz - 2] == '\n' ? - ROFF_REPARSE : ROFF_APPEND); + return buf->sz > 1 && buf->buf[buf->sz - 2] == '\n' ? + ROFF_REPARSE : ROFF_APPEND; } static size_t @@ -3210,7 +3210,7 @@ roff_getname(struct roff *r, char **cpp, int ln, int pos) name = *cpp; if ('\0' == *name) - return(0); + return 0; /* Read until end of name and terminate it with NUL. */ for (cp = name; 1; cp++) { @@ -3237,7 +3237,7 @@ roff_getname(struct roff *r, char **cpp, int ln, int pos) cp++; *cpp = cp; - return(namesz); + return namesz; } /* @@ -3337,14 +3337,14 @@ roff_getstrn(const struct roff *r, const char *name, size_t len) for (n = r->strtab; n; n = n->next) if (0 == strncmp(name, n->key.p, len) && '\0' == n->key.p[(int)len]) - return(n->val.p); + return n->val.p; for (i = 0; i < PREDEFS_MAX; i++) if (0 == strncmp(name, predefs[i].name, len) && '\0' == predefs[i].name[(int)len]) - return(predefs[i].str); + return predefs[i].str; - return(NULL); + return NULL; } static void @@ -3366,14 +3366,14 @@ const struct tbl_span * roff_span(const struct roff *r) { - return(r->tbl ? tbl_span(r->tbl) : NULL); + return r->tbl ? tbl_span(r->tbl) : NULL; } const struct eqn * roff_eqn(const struct roff *r) { - return(r->last_eqn ? &r->last_eqn->eqn : NULL); + return r->last_eqn ? &r->last_eqn->eqn : NULL; } /* @@ -3391,9 +3391,9 @@ roff_strdup(const struct roff *r, const char *p) enum mandoc_esc esc; if (NULL == r->xmbtab && NULL == r->xtab) - return(mandoc_strdup(p)); + return mandoc_strdup(p); else if ('\0' == *p) - return(mandoc_strdup("")); + return mandoc_strdup(""); /* * Step through each character looking for term matches @@ -3465,14 +3465,14 @@ roff_strdup(const struct roff *r, const char *p) } res[(int)ssz] = '\0'; - return(res); + return res; } int roff_getformat(const struct roff *r) { - return(r->format); + return r->format; } /* @@ -3495,17 +3495,17 @@ roff_getcontrol(const struct roff *r, const char *cp, int *ppos) if (0 != r->control && cp[pos] == r->control) pos++; else if (0 != r->control) - return(0); + return 0; else if ('\\' == cp[pos] && '.' == cp[pos + 1]) pos += 2; else if ('.' == cp[pos] || '\'' == cp[pos]) pos++; else - return(0); + return 0; while (' ' == cp[pos] || '\t' == cp[pos]) pos++; *ppos = pos; - return(1); + return 1; } |