=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.89 retrieving revision 1.92 diff -u -p -r1.89 -r1.92 --- mandoc/mandocdb.c 2013/12/27 20:35:51 1.89 +++ mandoc/mandocdb.c 2013/12/31 19:40:20 1.92 @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.89 2013/12/27 20:35:51 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.92 2013/12/31 19:40:20 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2013 Ingo Schwarze @@ -154,11 +154,9 @@ static int parse_mdoc_body(struct mpage *, const stru static int parse_mdoc_head(struct mpage *, const struct mdoc_node *); static int parse_mdoc_Fd(struct mpage *, const struct mdoc_node *); static int parse_mdoc_Fn(struct mpage *, const struct mdoc_node *); -static int parse_mdoc_In(struct mpage *, const struct mdoc_node *); static int parse_mdoc_Nd(struct mpage *, const struct mdoc_node *); static int parse_mdoc_Nm(struct mpage *, const struct mdoc_node *); static int parse_mdoc_Sh(struct mpage *, const struct mdoc_node *); -static int parse_mdoc_St(struct mpage *, const struct mdoc_node *); static int parse_mdoc_Xr(struct mpage *, const struct mdoc_node *); static void putkey(const struct mpage *, const char *, uint64_t); @@ -216,7 +214,7 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = { { parse_mdoc_Fn, 0 }, /* Fn */ { NULL, TYPE_Ft }, /* Ft */ { NULL, TYPE_Ic }, /* Ic */ - { parse_mdoc_In, TYPE_In }, /* In */ + { NULL, TYPE_In }, /* In */ { NULL, TYPE_Li }, /* Li */ { parse_mdoc_Nd, TYPE_Nd }, /* Nd */ { parse_mdoc_Nm, TYPE_Nm }, /* Nm */ @@ -224,7 +222,7 @@ static const struct mdoc_handler mdocs[MDOC_MAX] = { { NULL, 0 }, /* Ot */ { NULL, TYPE_Pa }, /* Pa */ { NULL, 0 }, /* Rv */ - { parse_mdoc_St, 0 }, /* St */ + { NULL, TYPE_St }, /* St */ { NULL, TYPE_Va }, /* Va */ { parse_mdoc_body, TYPE_Va }, /* Vt */ { parse_mdoc_Xr, 0 }, /* Xr */ @@ -855,16 +853,16 @@ mlinks_undupe(struct mpage *mpage) char *bufp; mpage->form = FORM_CAT; - for(prev = &mpage->mlinks; *prev; prev = &(*prev)->next) { - mlink = *prev; + prev = &mpage->mlinks; + while (NULL != (mlink = *prev)) { if (FORM_CAT != mlink->dform) { mpage->form = FORM_NONE; - continue; + goto nextlink; } if (strlcpy(buf, mlink->file, PATH_MAX) >= PATH_MAX) { if (warnings) say(mlink->file, "Filename too long"); - continue; + goto nextlink; } bufp = strstr(buf, "cat"); assert(NULL != bufp); @@ -874,14 +872,16 @@ mlinks_undupe(struct mpage *mpage) strlcat(buf, mlink->dsec, PATH_MAX); if (NULL == ohash_find(&mlinks, ohash_qlookup(&mlinks, buf))) - continue; + goto nextlink; if (warnings) say(mlink->file, "Man source exists: %s", buf); if (use_all) - continue; + goto nextlink; *prev = mlink->next; mlink_free(mlink); - mlink = *prev; + continue; +nextlink: + prev = &(*prev)->next; } } @@ -1439,21 +1439,10 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_n if (end > start) putkeys(mpage, start, end - start + 1, TYPE_In); - return(1); + return(0); } static int -parse_mdoc_In(struct mpage *mpage, const struct mdoc_node *n) -{ - - if (NULL != n->child && MDOC_TEXT == n->child->type) - return(0); - - putkey(mpage, n->child->string, TYPE_In); - return(1); -} - -static int parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n) { const char *cp; @@ -1487,17 +1476,6 @@ parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_n } static int -parse_mdoc_St(struct mpage *mpage, const struct mdoc_node *n) -{ - - if (NULL == n->child || MDOC_TEXT != n->child->type) - return(0); - - putkey(mpage, n->child->string, TYPE_St); - return(1); -} - -static int parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_node *n) { char *cp; @@ -1554,12 +1532,8 @@ static int parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_node *n) { - if (SEC_NAME == n->sec) - return(1); - else if (SEC_SYNOPSIS != n->sec || MDOC_HEAD != n->type) - return(0); - - return(1); + return(SEC_NAME == n->sec || + (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type)); } static int @@ -1732,7 +1706,6 @@ utf8key(struct mchars *mc, struct str *key) /* Read past the slash. */ val++; - u = 0; /* * Parse the escape sequence and see if it's a