Module Name:    src
Committed By:   snj
Date:           Tue Apr 14 04:26:04 UTC 2015

Modified Files:
        src/usr.sbin/makemandb [netbsd-7]: makemandb.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #675):
        usr.sbin/makemandb/makemandb.c: revision 1.27
- handle section numbers that are not single digits
- don't allocate and free needlessly


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.2 -r1.24.2.3 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.24.2.2 src/usr.sbin/makemandb/makemandb.c:1.24.2.3
--- src/usr.sbin/makemandb/makemandb.c:1.24.2.2	Sun Mar 15 22:44:28 2015
+++ src/usr.sbin/makemandb/makemandb.c	Tue Apr 14 04:26:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.24.2.2 2015/03/15 22:44:28 snj Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.24.2.3 2015/04/14 04:26:04 snj 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.24.2.2 2015/03/15 22:44:28 snj Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.24.2.3 2015/04/14 04:26:04 snj Exp $");
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -990,12 +990,11 @@ pmdoc_Nd(const struct mdoc_node *n, mand
 			 * An Xr macro was seen previously, so parse this
 			 * and the next node.
 			 */
-			temp = estrdup(n->string);
+			temp = n->string;
 			n = n->next;
 			easprintf(&buf, "%s(%s)", temp, n->string);
 			concat(&rec->name_desc, buf);
 			free(buf);
-			free(temp);
 		} else {
 			nd_text = estrdup(n->string);
 			replace_hyph(nd_text);
@@ -1052,13 +1051,8 @@ pmdoc_macro_handler(const struct mdoc_no
 			n = n->next;
 
 		if (n && n->type == MDOC_TEXT) {
-			size_t len = strlen(sn->string);
-			char *buf = emalloc(len + 4);
-			memcpy(buf, sn->string, len);
-			buf[len] = '(';
-			buf[len + 1] = n->string[0];
-			buf[len + 2] = ')';
-			buf[len + 3] = 0;
+			char *buf;
+			easprintf(&buf, "%s(%s)", sn->string, n->string);
 			mdoc_parse_section(n->sec, buf, rec);
 			free(buf);
 		}

Reply via email to