]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: optimize locale.h syntax check
authorEric Blake <eblake@redhat.com>
Wed, 4 Jun 2014 17:07:59 +0000 (11:07 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 4 Jun 2014 17:09:12 +0000 (11:09 -0600)
Reusing the maint.mk code allows for a more efficient syntax check
(fewer grep processes), and a more compact representation of what
we are really checking for in commit 1919e35.

* cfg.mk (sc_require_locale_h): Use maint.mk loop instead of
rolling our own.

Signed-off-by: Eric Blake <eblake@redhat.com>
cfg.mk

diff --git a/cfg.mk b/cfg.mk
index 675af21fcab3b41ecadf89600de3df25b5d69596..4601b3533dfd81ba01cbab93e28757f282d990f6 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -931,12 +931,10 @@ sc_prohibit_mixed_case_abbreviations:
 
 # Require #include <locale.h> in all files that call setlocale()
 sc_require_locale_h:
-       @for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do                  \
-               if ! grep -q setlocale\( $$i ; then continue; fi ;              \
-               if ! grep -q '# *include <locale.h>' $$i ; then                 \
-                       echo '$(ME): missing locale.h include in' $$i 1>&2; exit 1;     \
-               fi;                                                                                                                     \
-       done;
+       @require='include.*locale\.h'                                   \
+       containing='setlocale *('                                       \
+       halt='setlocale() requires <locale.h>'                          \
+         $(_sc_search_regexp)
 
 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null