Module Name:    src
Committed By:   christos
Date:           Fri Mar 27 21:48:06 UTC 2009

Modified Files:
        src/usr.bin/ctags: C.c

Log Message:
fix off-by-one bug that did not add a tag for "foo" in
    "typedef struct foo { int x; } foo_t";
as intended.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/ctags/C.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.bin/ctags/C.c
diff -u src/usr.bin/ctags/C.c:1.15 src/usr.bin/ctags/C.c:1.16
--- src/usr.bin/ctags/C.c:1.15	Sat Apr 22 13:46:48 2006
+++ src/usr.bin/ctags/C.c	Fri Mar 27 17:48:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: C.c,v 1.15 2006/04/22 17:46:48 christos Exp $	*/
+/*	$NetBSD: C.c,v 1.16 2009/03/27 21:48:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)C.c	8.4 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: C.c,v 1.15 2006/04/22 17:46:48 christos Exp $");
+__RCSID("$NetBSD: C.c,v 1.16 2009/03/27 21:48:05 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -216,6 +216,7 @@
 					break;
 				*sp = EOS;
 				if (tflag) {
+printf("1. %s t_def=%d level=%d t_level=%d\n", tok, t_def, level, t_level);
 					/* no typedefs inside typedefs */
 					if (!t_def &&
 						   !memcmp(tok, "typedef",8)) {
@@ -223,8 +224,9 @@
 						t_level = level;
 						break;
 					}
+printf("2. %s t_def=%d level=%d t_level=%d\n", tok, t_def, level, t_level);
 					/* catch "typedef struct" */
-					if ((!t_def || t_level < level)
+					if ((!t_def || t_level <= level)
 					    && (!memcmp(tok, "struct", 7)
 					    || !memcmp(tok, "union", 6)
 					    || !memcmp(tok, "enum", 5))) {

Reply via email to