git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/5] grep: remove redundant and verbose re-assignments to 0

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 28, 2017, 21:58 UTC
Message-ID
<20170628215809.23060-5-avarab@gmail.com>
In-Reply-To
<20170628215809.23060-1-avarab@gmail.com>

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>
---
 grep.c | 11 -----------
 1 file changed, 11 deletions(-)
diff --git a/grep.c b/grep.c
index 7cd8a6512f..736e1e00d6 100644
--- a/grep.c
+++ b/grep.c
@@ -175,28 +175,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
 		/*
@@ -206,7 +196,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;
 	}
-- 
2.13.1.611.g7e3b11ae1
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 8 of 19 in “grep: remove redundant code & reflags from API”
  1. 0/5 grep: remove redundant code & reflags from APIÆvar Arnfjörð Bjarmason, Jun 28, 2017
  2. 1/5 grep: remove redundant double assignment to 0Ævar Arnfjörð Bjarmason, Jun 28, 2017
  3. 3/5 grep: remove redundant "fixed" field re-assignment to 0Ævar Arnfjörð Bjarmason, Jun 28, 2017
  4. Stefan BellerJun 29, 2017
  5. 2/5 grep: remove redundant grep pattern type assignmentÆvar Arnfjörð Bjarmason, Jun 28, 2017
  6. Stefan BellerJun 29, 2017
  7. Ævar Arnfjörð BjarmasonJun 29, 2017
  8. 4/5 grep: remove redundant and verbose re-assignments to 0Ævar Arnfjörð Bjarmason, Jun 28, 2017
  9. 5/5 grep: remove regflags from the public grep_opt APIÆvar Arnfjörð Bjarmason, Jun 28, 2017
  10. Stefan BellerJun 29, 2017
  11. Ævar Arnfjörð BjarmasonJun 29, 2017
  12. 0/6 grep: remove redundant code & reflags from APIÆvar Arnfjörð Bjarmason, Jun 29, 2017
  13. 1/6 grep: remove redundant double assignment to 0Ævar Arnfjörð Bjarmason, Jun 29, 2017
  14. 2/6 grep: adjust a redundant grep pattern type assignmentÆvar Arnfjörð Bjarmason, Jun 29, 2017
  15. 3/6 grep: remove redundant "fixed" field re-assignment to 0Ævar Arnfjörð Bjarmason, Jun 29, 2017
  16. 4/6 grep: remove redundant and verbose re-assignments to 0Ævar Arnfjörð Bjarmason, Jun 29, 2017
  17. 6/6 grep: remove redundant REG_NEWLINE when compiling fixed regexÆvar Arnfjörð Bjarmason, Jun 29, 2017
  18. 5/6 grep: remove regflags from the public grep_opt APIÆvar Arnfjörð Bjarmason, Jun 29, 2017
  19. Junio C HamanoJun 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.