Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makemandb We don't need to parse the sections we do...



details:   https://anonhg.NetBSD.org/src/rev/7fd15d782301
branches:  trunk
changeset: 348070:7fd15d782301
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Mon Oct 03 16:11:11 2016 +0000

description:
We don't need to parse the sections we don't index, so stop early. Saves few
instructions.

diffstat:

 usr.sbin/makemandb/makemandb.c |  28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diffs (56 lines):

diff -r a44209b63bb2 -r 7fd15d782301 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c    Mon Oct 03 14:26:02 2016 +0000
+++ b/usr.sbin/makemandb/makemandb.c    Mon Oct 03 16:11:11 2016 +0000
@@ -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 <er.abhinav.upadhyay%gmail.com@localhost>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__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 <sys/stat.h>
 #include <sys/types.h>
@@ -1089,6 +1089,22 @@
        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 @@
        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;



Home | Main Index | Thread Index | Old Index