summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2010-04-15 21:41:07 +0000
committeravg <avg@FreeBSD.org>2010-04-15 21:41:07 +0000
commit1e60f70fdddc6c9caf965fdd1ee6d2f9a62e9fac (patch)
tree9fc504ddefde04a639c451d2f226a456e3380310 /usr.bin/indent
parent01137d93391442d08f0e2535b78cbc0e25bd15f8 (diff)
downloadFreeBSD-src-1e60f70fdddc6c9caf965fdd1ee6d2f9a62e9fac.zip
FreeBSD-src-1e60f70fdddc6c9caf965fdd1ee6d2f9a62e9fac.tar.gz
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@omut.org> MFC after: 1 week
Diffstat (limited to 'usr.bin/indent')
-rw-r--r--usr.bin/indent/lexi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/indent/lexi.c b/usr.bin/indent/lexi.c
index 3d415d0..b3604c6 100644
--- a/usr.bin/indent/lexi.c
+++ b/usr.bin/indent/lexi.c
@@ -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;
OpenPOWER on IntegriCloud