Module Name:    src
Committed By:   abhinav
Date:           Mon Oct  3 16:11:11 UTC 2016

Modified Files:
        src/usr.sbin/makemandb: makemandb.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/makemandb/makemandb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.43 src/usr.sbin/makemandb/makemandb.c:1.44
--- src/usr.sbin/makemandb/makemandb.c:1.43	Mon Oct  3 13:53:39 2016
+++ src/usr.sbin/makemandb/makemandb.c	Mon Oct  3 16:11:11 2016
@@ -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.upadh...@gmail.com>
  * Copyright (c) 2011 Kristaps Dzonsons <krist...@bsd.lv>
@@ -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 @@ pmdoc_Sh(const struct roff_node *n, mand
 	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, co
 	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;

Reply via email to