Skip to content

nd/icase updates

Nguyễn Thái Ngọc Duy git 6 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest12 patches 0 repliesNew
  2. v611 patches 13 repliesSuperseded
  3. v510 patches 7 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v410 patches0 repliesSuperseded
v39 patches3 repliesSuperseded
v29 patches7 repliesSuperseded

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12grep: allow -F -i combinationbuiltin/grep.c+1 -10 replies
2/12grep: break down an "if" stmt in preparation for next changesgrep.c+3 -10 replies
3/12test-regex: isolate the bug test codet/t0070-fundamental.sh test-regex.c+11 -30 replies
4/12test-regex: expose full regcomp() to the command linetest-regex.c+49 -20 replies
5/12grep/icase: avoid kwsset on literal non-ascii stringsgrep.c t/t7812-grep-icase-non-ascii.sh+29 -10 replies
6/12grep/icase: avoid kwsset when -F is specifiedgrep.c quote.c quote.h +1 more+88 -10 replies
7/12grep/pcre: prepare locale-dependent tables for icase matchinggrep.c grep.h t/t7813-grep-icase-iso.sh+26 -20 replies
8/12gettext: add is_utf8_locale()gettext.c gettext.h+23 -20 replies
9/12grep/pcre: support utf-8grep.c t/t7812-grep-icase-non-ascii.sh+17 -00 replies
10/12diffcore-pickaxe: "share" regex error handling codediffcore-pickaxe.c+8 -80 replies
11/12diffcore-pickaxe: support case insensitive match on non-asciidiffcore-pickaxe.c t/t7812-grep-icase-non-ascii.sh+18 -00 replies
12/12grep.c: reuse "icase" variablegrep.c+1 -40 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by.

PatchPlamen TotevEric SunshineRamsay JonesRené ScharfeÆvar Arnfjörð Bjarmason
1/12
2/12
3/12Helped-by Helped-by
4/12
5/12Noticed-by Helped-by Helped-by
6/12Noticed-by Helped-by Helped-by
7/12
8/12Helped-by
9/12Noticed-by Helped-by
10/12
11/12Noticed-by
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v7 thread

Cover letter [PATCH v7 00/12] nd/icase updates

v7 addresses two comments from Junio and Eric in v6 and adds an extra patch, 12/12, which reuses "icase" variable and avoids recalculating the same thing (which can't be done before v6). Interdiff

grep.c +6 -8
index aed4fe0..cb058a5 100644
@@ -432,22 +432,20 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
 	icase	       = opt->regflags & REG_ICASE || p->ignore_case;
 	ascii_only     = !has_non_ascii(p->pattern);
 
-	if ((!icase || ascii_only) && is_fixed(p->pattern, p->patternlen))
-		p->fixed = 1;
-	else if (opt->fixed) {
+	if (opt->fixed) {
 		p->fixed = !icase || ascii_only;
 		if (!p->fixed) {
 			compile_fixed_regexp(p, opt);
 			return;
 		}
-	} else
+	} else if ((!icase || ascii_only) &&
+		   is_fixed(p->pattern, p->patternlen))
+		p->fixed = 1;
+	else
 		p->fixed = 0;
 
 	if (p->fixed) {
-		if (opt->regflags & REG_ICASE || p->ignore_case)
-			p->kws = kwsalloc(tolower_trans_tbl);
-		else
-			p->kws = kwsalloc(NULL);
+		p->kws = kwsalloc(icase ? tolower_trans_tbl : NULL);
 		kwsincr(p->kws, p->pattern, p->patternlen);
 		kwsprep(p->kws);
 		return;
test-regex.c +2 -2
index d1a952c..eff26f5 100644
@@ -47,8 +47,8 @@ int main(int argc, char **argv)
 	if (argc == 2 && !strcmp(argv[1], "--bug"))
 		return test_regex_bug();
 	else if (argc < 3)
-		die("usage: test-regex --bug\n"
-		    "       test-regex <pattern> <string> [<options>]");
+		usage("test-regex --bug\n"
+		      "test-regex <pattern> <string> [<options>]");
 
 	argv++;
 	pat = *argv++;

Nguyễn Thái Ngọc Duy (12):
grep: allow -F -i combination
grep: break down an "if" stmt in preparation for next changes
test-regex: isolate the bug test code
test-regex: expose full regcomp() to the command line grep/icase: avoid kwsset on literal non-ascii strings grep/icase: avoid kwsset when -F is specified grep/pcre: prepare locale-dependent tables for icase matching
gettext: add is_utf8_locale()
grep/pcre: support utf-8
diffcore-pickaxe: "share" regex error handling code
diffcore-pickaxe: support case insensitive match on non-ascii grep.c: reuse "icase" variable

 builtin/grep.c                           |  2 +-
 diffcore-pickaxe.c                       | 27 ++++++++----
 gettext.c                                | 24 ++++++++++-
 gettext.h                                |  1 +
 grep.c                                   | 47 +++++++++++++++++----
 grep.h                                   |  1 +
 quote.c                                  | 37 +++++++++++++++++
 quote.h                                  |  1 +
 t/t0070-fundamental.sh                   |  2 +-
 t/t7812-grep-icase-non-ascii.sh (new +x) | 71 ++++++++++++++++++++++++++++++++
 t/t7813-grep-icase-iso.sh (new +x)       | 19 +++++++++
 test-regex.c                             | 59 +++++++++++++++++++++++++-
 12 files changed, 270 insertions(+), 21 deletions(-)
 create mode 100755 t/t7812-grep-icase-non-ascii.sh
 create mode 100755 t/t7813-grep-icase-iso.sh
Signature · 1 line
2.7.0.377.g4cd97dd