grep: remove redundant and verbose re-assignments to 0
[gitweb.git] / grep.c
diff --git a/grep.c b/grep.c
index 98733db623ae2a0c4b3c11b71e3560429ec975ff..7fcdaa0753b7a9678e5eb4d0ad8aff9728bd6ea9 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -38,7 +38,6 @@ void init_grep_defaults(void)
        opt->regflags = REG_NEWLINE;
        opt->max_depth = -1;
        opt->pattern_type_option = GREP_PATTERN_TYPE_UNSPECIFIED;
-       opt->extended_regexp_option = 0;
        color_set(opt->color_context, "");
        color_set(opt->color_filename, "");
        color_set(opt->color_function, "");
@@ -79,10 +78,7 @@ int grep_config(const char *var, const char *value, void *cb)
                return -1;
 
        if (!strcmp(var, "grep.extendedregexp")) {
-               if (git_config_bool(var, value))
-                       opt->extended_regexp_option = 1;
-               else
-                       opt->extended_regexp_option = 0;
+               opt->extended_regexp_option = git_config_bool(var, value);
                return 0;
        }
 
@@ -178,28 +174,18 @@ static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, st
                /* fall through */
 
        case GREP_PATTERN_TYPE_BRE:
-               opt->fixed = 0;
-               opt->pcre1 = 0;
-               opt->pcre2 = 0;
                break;
 
        case GREP_PATTERN_TYPE_ERE:
-               opt->fixed = 0;
-               opt->pcre1 = 0;
-               opt->pcre2 = 0;
                opt->regflags |= REG_EXTENDED;
                break;
 
        case GREP_PATTERN_TYPE_FIXED:
                opt->fixed = 1;
-               opt->pcre1 = 0;
-               opt->pcre2 = 0;
                break;
 
        case GREP_PATTERN_TYPE_PCRE:
-               opt->fixed = 0;
 #ifdef USE_LIBPCRE2
-               opt->pcre1 = 0;
                opt->pcre2 = 1;
 #else
                /*
@@ -209,7 +195,6 @@ static void grep_set_pattern_type_option(enum grep_pattern_type pattern_type, st
                 * "cannot use Perl-compatible regexes[...]".
                 */
                opt->pcre1 = 1;
-               opt->pcre2 = 0;
 #endif
                break;
        }
@@ -630,8 +615,6 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
            has_null(p->pattern, p->patternlen) ||
            is_fixed(p->pattern, p->patternlen))
                p->fixed = !icase || ascii_only;
-       else
-               p->fixed = 0;
 
        if (p->fixed) {
                p->kws = kwsalloc(icase ? tolower_trans_tbl : NULL);