From e10864227311b98859137cb0bb572099b74b830e Mon Sep 17 00:00:00 2001 From: abhinav Date: Mon, 3 Oct 2016 16:11:11 +0000 Subject: [PATCH] We don't need to parse the sections we don't index, so stop early. Saves few instructions. --- usr.sbin/makemandb/makemandb.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/usr.sbin/makemandb/makemandb.c b/usr.sbin/makemandb/makemandb.c index 010235659eb4..a62093dd9017 100644 --- a/usr.sbin/makemandb/makemandb.c +++ b/usr.sbin/makemandb/makemandb.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemandb.c,v 1.43 2016/10/03 13:53:39 abhinav Exp $ */ +/* $NetBSD: makemandb.c,v 1.44 2016/10/03 16:11:11 abhinav Exp $ */ /* * Copyright (c) 2011 Abhinav Upadhyay * Copyright (c) 2011 Kristaps Dzonsons @@ -17,7 +17,7 @@ */ #include -__RCSID("$NetBSD: makemandb.c,v 1.43 2016/10/03 13:53:39 abhinav Exp $"); +__RCSID("$NetBSD: makemandb.c,v 1.44 2016/10/03 16:11:11 abhinav Exp $"); #include #include @@ -1089,6 +1089,22 @@ pmdoc_Sh(const struct roff_node *n, mandb_rec *rec) if (n == NULL) return; + switch (n->sec) { + case SEC_NAME: + case SEC_SYNOPSIS: + case SEC_EXAMPLES: + case SEC_STANDARDS: + case SEC_HISTORY: + case SEC_AUTHORS: + case SEC_BUGS: + /* + * We don't care about text from these sections + */ + return; + default: + break; + } + if (n->type == ROFFT_BLOCK) mdoc_parse_Sh(n->body, rec); } @@ -1175,14 +1191,6 @@ mdoc_parse_section(enum roff_sec sec, const char *string, mandb_rec *rec) case SEC_ERRORS: append(&rec->errors, string); break; - case SEC_NAME: - case SEC_SYNOPSIS: - case SEC_EXAMPLES: - case SEC_STANDARDS: - case SEC_HISTORY: - case SEC_AUTHORS: - case SEC_BUGS: - break; default: append(&rec->desc, string); break;