svn commit: r206687 - head/usr.bin/indent

Andriy Gapon avg at FreeBSD.org
Thu Apr 15 21:41:07 UTC 2010


Author: avg
Date: Thu Apr 15 21:41:07 2010
New Revision: 206687
URL: http://svn.freebsd.org/changeset/base/206687

Log:
  indent(1): don't treat bare '_t' as a type name when -ta is used
  
  It seems that identifier "_t" is sometimes used as a variable name,
  even in our tree.  Not that I endorse that, but still it's better
  to require at least one character before _t suffix to consider
  an identifier to be a type name.
  
  Reported by:	Alex Vasylenko <lxv at omut.org>
  MFC after:	1 week

Modified:
  head/usr.bin/indent/lexi.c

Modified: head/usr.bin/indent/lexi.c
==============================================================================
--- head/usr.bin/indent/lexi.c	Thu Apr 15 21:18:24 2010	(r206686)
+++ head/usr.bin/indent/lexi.c	Thu Apr 15 21:41:07 2010	(r206687)
@@ -251,9 +251,10 @@ lexi(void)
 
 	if (auto_typedefs) {
 	    const char *q = s_token;
+	    size_t q_len = strlen(q);
 	    /* Check if we have an "_t" in the end */
-	    if (q[0] && q[1] &&
-	        (strcmp(q + strlen(q) - 2, "_t") == 0)) {
+	    if (q_len > 2 &&
+	        (strcmp(q + q_len - 2, "_t") == 0)) {
 	        ps.its_a_keyword = true;
 		ps.last_u_d = true;
 	        goto found_auto_typedef;


More information about the svn-src-all mailing list