maint.mk: include 4 more function names in alloca.h-checking regexp
authorJim Meyering <meyering@redhat.com>
Tue, 5 Jan 2010 14:12:15 +0000 (15:12 +0100)
committerIan Beckwith <ianb@erislabs.net>
Sun, 10 Jan 2010 00:20:40 +0000 (00:20 +0000)
* top/maint.mk (sc_prohibit_xalloc_without_use): Use more complete
regexp.  Before, we would give a false-positive (saying alloca.h
is included unnecessarily) when the only uses involved omitted symbols.
(cherry picked from commit 0c2fded89d2ebb3395d176001182ef710d68d430)

ChangeLog
top/maint.mk

index 55c4772..1313708 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-01-05  Jim Meyering  <meyering@redhat.com>
 
+       maint.mk: include 4 more function names in alloca.h-checking regexp
+       * top/maint.mk (sc_prohibit_xalloc_without_use): Use more complete
+       regexp.  Before, we would give a false-positive (saying alloca.h
+       is included unnecessarily) when the only uses involved omitted symbols.
+
        xalloc.h: use consistent formatting
        * lib/xalloc.h: Move declarations to start in the first column.
 
index 2bdf1eb..e4a6359 100644 (file)
@@ -324,9 +324,15 @@ sc_prohibit_error_without_use:
 # | sort | perl -MRegexp::Assemble -le \
 #  'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g'
 # Note this was produced by the above:
-# _xa1 = x(alloc_(oversized|die)|([cz]|2?re)alloc|m(alloc|emdup)|strdup)
-# But we can do better:
-_xa1 = x(alloc_(oversized|die)|([cmz]|2?re)alloc|(mem|str)dup)
+# _xa1 = \
+#x(((2n?)?re|c(har)?|n(re|m)|z)alloc|alloc_(oversized|die)|m(alloc|emdup)|strdup)
+# But we can do better, in at least two ways:
+# 1) take advantage of two "dup"-suffixed strings:
+# x(((2n?)?re|c(har)?|n(re|m)|[mz])alloc|alloc_(oversized|die)|(mem|str)dup)
+# 2) notice that "c(har)?|[mz]" is equivalent to the shorter and more readable
+# "char|[cmz]"
+# x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup)
+_xa1 = x(((2n?)?re|char|n(re|m)|[cmz])alloc|alloc_(oversized|die)|(mem|str)dup)
 _xa2 = X([CZ]|N?M)ALLOC
 sc_prohibit_xalloc_without_use:
        @h='"xalloc.h"' \