grep: remove redundant and verbose re-assignments to 0
Remove the redundant re-assignments of the fixed/pcre1/pcre2 fields to zero right after the entire struct has been set to zero via memset(...). See an earlier related cleanup commit e0b9f8ae09 ("grep: remove redundant regflags assignments", 2017-05-25) for an explanation of why the code was structured like this to begin with. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Jun 29, 2017 at 22:22 UTC
b07ed4e532fa9492a53b7b510c45efd671f468a8
1 file changed
-11
grep.c
-11
@@ -174,28 +174,18 @@ static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, st
174
/* fall through */
175
176
case GREP_PATTERN_TYPE_BRE:
177
- opt->fixed = 0;
178
- opt->pcre1 = 0;
179
- opt->pcre2 = 0;
177
break;
178
179
case GREP_PATTERN_TYPE_ERE:
183
- opt->fixed = 0;
184
- opt->pcre1 = 0;
185
- opt->pcre2 = 0;
180
opt->regflags |= REG_EXTENDED;
181
break;
182
183
case GREP_PATTERN_TYPE_FIXED:
184
opt->fixed = 1;
191
- opt->pcre1 = 0;
192
- opt->pcre2 = 0;
185
break;
186
187
case GREP_PATTERN_TYPE_PCRE:
196
- opt->fixed = 0;
188
#ifdef USE_LIBPCRE2
198
- opt->pcre1 = 0;
189
opt->pcre2 = 1;
190
#else
191
/*
@@ -205,7 +195,6 @@ static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, st
195
* "cannot use Perl-compatible regexes[...]".
196
*/
197
opt->pcre1 = 1;
208
- opt->pcre2 = 0;
198
#endif
199
break;
200
}