From a1a285477bfe246897c20026ebecdeec147da12a Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 31 Dec 2013 19:40:20 +0000 Subject: Yet another regression introduced by Kristaps when he switched from Berkeley DB to SQLite3: In the .In parser, the logic got inverted. The resulting NULL pointer access was found by clang; scan log provided by Ulrich Spoerlein . The best fix is to simply remove the whole, pointless custom handler function for .In and let the framework do its work. Now searching for included header files actually works. While here, remove the similarly pointless custom .St handler, fix the return value of the .Fd handler and disentangle the spaghetti in the .Nm handler. --- mandocdb.c | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) (limited to 'mandocdb.c') diff --git a/mandocdb.c b/mandocdb.c index 514ce7aa..31d16826 100644 --- a/mandocdb.c +++ b/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.91 2013/12/31 18:07:42 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 struct mdoc_node *); 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 */ @@ -1441,18 +1439,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_node *n) if (end > start) putkeys(mpage, start, end - start + 1, TYPE_In); - return(1); -} - -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); + return(0); } static int @@ -1488,17 +1475,6 @@ parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n) return(0); } -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) { @@ -1556,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 -- cgit v1.2.3-56-ge451