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

[PATCH] grep: simplify assignment of ->fixed

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Feb 3, 2010, 18:16 UTC
Message-ID
<4B69BD7E.1040204@lsrfire.ath.cx>

After 885d211e, the value of the ->fixed pattern option only depends on the grep option of the same name. Regex flags don't matter any more, because fixed mode and regex mode are strictly separated. Thus we can simply copy the value from struct grep_opt to struct grep_pat, as we do already for ->word_regexp and ->ignore_case.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 grep.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/grep.c b/grep.c
index 60cce46..a0864f1 100644
--- a/grep.c
+++ b/grep.c
@@ -57,11 +57,8 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
 
 	p->word_regexp = opt->word_regexp;
 	p->ignore_case = opt->ignore_case;
+	p->fixed = opt->fixed;
 
-	if (opt->fixed)
-		p->fixed = 1;
-	if (opt->regflags & REG_ICASE)
-		p->fixed = 0;
 	if (p->fixed)
 		return;
 
-- 
1.7.0.rc1
Message 1 of 1 in “grep: simplify assignment of ->fixed”
  1. grep: simplify assignment of ->fixedRené Scharfe, Feb 3, 2010

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.