Skip to content

Commit b07ed4e

Browse files
avargitster
authored andcommitted
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 e0b9f8a ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 885ef80 commit b07ed4e

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

grep.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,28 +174,18 @@ static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, st
174174
/* fall through */
175175

176176
case GREP_PATTERN_TYPE_BRE:
177-
opt->fixed = 0;
178-
opt->pcre1 = 0;
179-
opt->pcre2 = 0;
180177
break;
181178

182179
case GREP_PATTERN_TYPE_ERE:
183-
opt->fixed = 0;
184-
opt->pcre1 = 0;
185-
opt->pcre2 = 0;
186180
opt->regflags |= REG_EXTENDED;
187181
break;
188182

189183
case GREP_PATTERN_TYPE_FIXED:
190184
opt->fixed = 1;
191-
opt->pcre1 = 0;
192-
opt->pcre2 = 0;
193185
break;
194186

195187
case GREP_PATTERN_TYPE_PCRE:
196-
opt->fixed = 0;
197188
#ifdef USE_LIBPCRE2
198-
opt->pcre1 = 0;
199189
opt->pcre2 = 1;
200190
#else
201191
/*
@@ -205,7 +195,6 @@ static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, st
205195
* "cannot use Perl-compatible regexes[...]".
206196
*/
207197
opt->pcre1 = 1;
208-
opt->pcre2 = 0;
209198
#endif
210199
break;
211200
}

0 commit comments

Comments
 (0)