maint: optimize locale.h syntax check

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>
This commit is contained in:
Eric Blake 2014-06-04 11:07:59 -06:00
parent 9e0cbcd888
commit d804a58a15

10
cfg.mk
View File

@ -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