Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb largely apply patch from PR bin/47392 by ...
details: https://anonhg.NetBSD.org/src/rev/1c45db1ac507
branches: trunk
changeset: 337229:1c45db1ac507
user: plunky <plunky%NetBSD.org@localhost>
date: Tue Apr 07 17:47:10 2015 +0000
description:
largely apply patch from PR bin/47392 by Abhinav Upadhyay
change some comments to reflect reality, a variable name to enhance
readability, and adds an assert for safety.
diffstat:
usr.sbin/makemandb/makemandb.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diffs (57 lines):
diff -r 24118da4c6e2 -r 1c45db1ac507 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c Tue Apr 07 17:41:42 2015 +0000
+++ b/usr.sbin/makemandb/makemandb.c Tue Apr 07 17:47:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makemandb.c,v 1.28 2015/03/12 14:57:18 joerg Exp $ */
+/* $NetBSD: makemandb.c,v 1.29 2015/04/07 17:47:10 plunky 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.28 2015/03/12 14:57:18 joerg Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.29 2015/04/07 17:47:10 plunky Exp $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -75,7 +75,7 @@
secbuff errors; // ERRORS
char section[2];
- int xr_found;
+ int xr_found; // To track whether a .Xr was seen when parsing a section
/* Fields for mandb_meta table */
char *md5_hash;
@@ -973,12 +973,8 @@
static void
pmdoc_Nd(const struct mdoc_node *n, mandb_rec *rec)
{
- /*
- * A static variable for keeping track of whether a Xr macro was seen
- * previously.
- */
char *buf = NULL;
- char *temp;
+ char *name;
char *nd_text;
if (n == NULL || (n->type != MDOC_TEXT && n->tok == MDOC_MAX))
@@ -988,11 +984,12 @@
if (rec->xr_found && n->next) {
/*
* An Xr macro was seen previously, so parse this
- * and the next node.
+ * and the next node, as "Name(Section)".
*/
- temp = n->string;
+ name = n->string;
n = n->next;
- easprintf(&buf, "%s(%s)", temp, n->string);
+ assert(n->type == MDOC_TEXT);
+ easprintf(&buf, "%s(%s)", name, n->string);
concat(&rec->name_desc, buf);
free(buf);
} else {
Home |
Main Index |
Thread Index |
Old Index