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. --- ChangeLog | 9 +++++++++ top/maint.mk | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog index 7dd78e3..b698a6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-07-26 Ján Tomko <[email protected]> + 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. + +2016-07-26 Ján Tomko <[email protected]> + maint.mk: speed up po_check There is some logic in sc_po_check that skips files based on their diff --git a/top/maint.mk b/top/maint.mk index a907bff..b074609 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -953,8 +953,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_ = \ + $(shell echo $(prohibit_doubled_words_) | sed -r 's/\b(\S+)\b/\1\\s\+\1/g') prohibit_doubled_word_RE_ ?= \ - /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims + /\b(?:$(subst $(space),|,$(prohibit_doubled_word_expanded_)))\b/gims prohibit_doubled_word_ = \ -e 'while ($(prohibit_doubled_word_RE_))' \ $(perl_filename_lineno_text_) -- 2.7.3
