changeset 12576:51b39cac47f1

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.
author Jim Meyering <meyering@redhat.com>
date Tue, 05 Jan 2010 15:12:15 +0100
parents 7b84f51e4373
children 64b96a2d148c
files ChangeLog top/maint.mk
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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.
 
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -324,9 +324,15 @@
 # | 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"' \