Skip to content

Commit 0ddf8ce

Browse files
avargitster
authored andcommitted
grep/pcre2: drop needless assignment + assert() on opt->pcre2
Drop an assignment added in b65abca (grep: use PCRE v2 for optimized fixed-string search, 2019-07-01) and the overly cautious assert() I added in 94da919 (grep: add support for PCRE v2, 2017-06-01). There was never a good reason for this, it's just a relic from when I initially wrote the PCREv2 support. We're not going to have confusion about compile_pcre2_pattern() being called when it shouldn't just because we forgot to cargo-cult this opt->pcre2 option. Furthermore the "struct grep_opt" is (mostly) used for the options the user supplied, let's avoid the pattern of needlessly assigning to it. With my recent removal of the PCREv1 backend in 7599730 (Remove support for v1 of the PCRE library, 2021-01-24) there's even less confusion around what we call where in these codepaths, which is one more reason to remove this. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 328c109 commit 0ddf8ce

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

grep.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,6 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
373373
int patinforet;
374374
size_t jitsizearg;
375375

376-
assert(opt->pcre2);
377-
378376
p->pcre2_compile_context = NULL;
379377

380378
/* pcre2_global_context is initialized in append_grep_pattern */
@@ -555,7 +553,6 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
555553
#endif
556554
if (p->fixed || p->is_fixed) {
557555
#ifdef USE_LIBPCRE2
558-
opt->pcre2 = 1;
559556
if (p->is_fixed) {
560557
compile_pcre2_pattern(p, opt);
561558
} else {

0 commit comments

Comments
 (0)