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

[PATCH] grep: remove tautological check

From
David Soria Parra <dsp@php.net>
Date
Oct 20, 2012, 17:26 UTC
Message-ID
<1350753964-29346-1-git-send-email-dsp@php.net>

The enum grep_header_field is unsigned. Therefore the field part of the grep_pat structure is unsigned and cannot be less then 0. We remove the tautological check for p->field < 0.

Signed-off-by: David Soria Parra <dsp@php.net>
---
 grep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grep.c b/grep.c
index 4bd1b8b..db177ef 100644
--- a/grep.c
+++ b/grep.c
@@ -625,7 +625,7 @@ static struct grep_expr *prep_header_patterns(struct grep_opt *opt)
 	for (p = opt->header_list; p; p = p->next) {
 		if (p->token != GREP_PATTERN_HEAD)
 			die("bug: a non-header pattern in grep header list.");
-		if (p->field < 0 || GREP_HEADER_FIELD_MAX <= p->field)
+		if (GREP_HEADER_FIELD_MAX <= p->field)
 			die("bug: unknown header field %d", p->field);
 		compile_regexp(p, opt);
 	}
-- 
1.8.0.rc3.332.g181c802
Next: Peter Krefting
Message 1 of 3 in “grep: remove tautological check”
  1. grep: remove tautological checkDavid Soria Parra, Oct 20, 2012
  2. Peter KreftingOct 20, 2012
  3. Peter KreftingOct 22, 2012

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.