diff options
author | Ján Tomko <jtomko@redhat.com> | 2016-08-02 15:41:13 +0200 |
---|---|---|
committer | Jim Meyering <meyering@fb.com> | 2016-08-02 08:31:43 -0700 |
commit | 0fe8b3c8116168e3b8b058df63ddedd45c3fcab0 (patch) | |
tree | fcc8872464b275cda60da56fab8d2d262e845337 /top/maint.mk | |
parent | 4f5dc0ac1e08ecc3a2c6eb0e2a8ff526de972b4f (diff) | |
download | gnulib-0fe8b3c8116168e3b8b058df63ddedd45c3fcab0.tar.gz |
maint.mk: expand the prohibit_doubled_word regex
This check has a static list of words that are checked for
repetitions. Expand it before running the perl script to
avoid using expensive captures. This decreases the cost
for libvirt from 1.66s to 0.66s.
* top/maint.mk (prohibit_doubled_word_expanded_): Define.
(sc_prohibit_doubled_word): Use it.
Diffstat (limited to 'top/maint.mk')
-rw-r--r-- | top/maint.mk | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/top/maint.mk b/top/maint.mk index 9ca2bd3b32..868e10f004 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -962,8 +962,13 @@ perl_filename_lineno_text_ = \ -e ' print "$$ARGV:$$n:$$v\n";' \ -e ' }' +prohibit_doubled_words_ = \ + the then in an on if is it but for or at and do to +# expand the regex before running the check to avoid using expensive captures +prohibit_doubled_word_expanded_ = \ + $(join $(prohibit_doubled_words_),$(addprefix \s+,$(prohibit_doubled_words_))) prohibit_doubled_word_RE_ ?= \ - /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims + /\b(?:$(subst $(_sp),|,$(prohibit_doubled_word_expanded_)))\b/gims prohibit_doubled_word_ = \ -e 'while ($(prohibit_doubled_word_RE_))' \ $(perl_filename_lineno_text_) |