NetBSD-Bugs archive

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

Re: bin/47392: Fix a comment in makemandb.c to reflect reality



The following reply was made to PR bin/47392; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/47392: Fix a comment in makemandb.c to reflect reality
Date: Fri, 4 Jan 2013 10:05:06 +0000

 (please send PR traffic to gnats-bugs)
 
    ------
 
 From: Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
 To: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
 Subject: Re: bin/47392: Fix a comment in makemandb.c to reflect reality
 Date: Thu, 3 Jan 2013 01:48:47 +0530
 
 On Wed, Jan 02, 2013 at 05:10:00PM +0000, 
er.abhinav.upadhyay%gmail.com@localhost wrote:
 > >Number:         47392
 > >Category:       bin
 > >Synopsis:       Fix a comment in makemandb.c to reflect reality
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    bin-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Wed Jan 02 17:10:00 +0000 2013
 > >Originator:     Abhinav Upadhyay
 > >Release:        NetBSD-current
 > >Organization:
 > >Environment:
 > NetBSD  6.99.15 NetBSD 6.99.15 (GENERIC) #0: Fri Nov 30 23:27:05 UTC 2012  
 > builds%b6.netbsd.org@localhost:/home/builds/ab/HEAD/i386/201211301540Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC
 >  i386
 > >Description:
 > The comment in makemandb.c at line 943 does not hold true anymore, it is out 
 > of sync. It should be removed.
 > >How-To-Repeat:
 > 
 > >Fix:
 > Index: makemandb.c
 > ===================================================================
 > RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
 > retrieving revision 1.16
 > diff -u -r1.16 makemandb.c
 > --- makemandb.c      8 Nov 2012 19:17:54 -0000       1.16
 > +++ makemandb.c      2 Jan 2013 17:02:18 -0000
 > @@ -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;
 > @@ -940,10 +940,6 @@
 >  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;
 >  
 > 
 Please apply the attached patch, which changes a couple of variable
 names for better readability.
 
 
 
 Index: makemandb.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
 retrieving revision 1.16
 diff -u -r1.16 makemandb.c
 --- makemandb.c        8 Nov 2012 19:17:54 -0000       1.16
 +++ makemandb.c        2 Jan 2013 20:01:56 -0000
 @@ -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;
 @@ -940,12 +940,9 @@
  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 *section;
  
        if (n == NULL)
                return;
 @@ -956,12 +953,14 @@
                         * An Xr macro was seen previously, so parse this
                         * and the next node.
                         */
 -                      temp = estrdup(n->string);
 +                      name = estrdup(n->string);
                        n = n->next;
 -                      easprintf(&buf, "%s(%s)", temp, n->string);
 +            assert(n->type == MDOC_TEXT);
 +            section = n->string;
 +                      easprintf(&buf, "%s(%s)", name, section);
                        concat(&rec->name_desc, buf);
                        free(buf);
 -                      free(temp);
 +                      free(name);
                } else {
                        concat(&rec->name_desc, n->string);
                }
 


Home | Main Index | Thread Index | Old Index