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

[PATCH] diff: parse ws-error-highlight option more strictly

From
René Scharfe <l.s.r@web.de>
Date
Jul 11, 2015, 12:58 UTC
Message-ID
<55A112ED.3090004@web.de>

Check if a matched token is followed by a delimiter before advancing the pointer arg. This avoids accepting composite words like "allnew" or "defaultcontext".

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 diff.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/diff.c b/diff.c
index 87b16d5..0f17ec5 100644
--- a/diff.c
+++ b/diff.c
@@ -3653,7 +3653,12 @@ static void enable_patch_output(int *fmt) {
 
 static int parse_one_token(const char **arg, const char *token)
 {
-	return skip_prefix(*arg, token, arg) && (!**arg || **arg == ',');
+	const char *rest;
+	if (skip_prefix(*arg, token, &rest) && (!*rest || *rest == ',')) {
+		*arg = rest;
+		return 1;
+	}
+	return 0;
 }
 
 static int parse_ws_error_highlight(struct diff_options *opt, const char *arg)
-- 
2.4.4
Next: Junio C Hamano
Message 1 of 2 in “diff: parse ws-error-highlight option more strictly”
  1. diff: parse ws-error-highlight option more strictlyRené Scharfe, Jul 11, 2015
  2. Junio C HamanoJul 12, 2015

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.