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

[PATCH] Fix parsing numeric color values

From
THTimo Hirvonen <tihirvon@gmail.com>
Date
Feb 5, 2008, 19:18 UTC
Message-ID
<20080205211821.e4a15194.tihirvon@gmail.com>
In-Reply-To
<20080205205856.76a7cd45.tihirvon@gmail.com>
Fix bug reported by Chris Larson <clarson@kergoth.com>.  Numeric color
only worked if it was at end of line.
---
 color.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/color.c b/color.c
index 7f66c29..3c999c3 100644
--- a/color.c
+++ b/color.c
@@ -17,7 +17,7 @@ static int parse_color(const char *name, int len)
 			return i - 1;
 	}
 	i = strtol(name, &end, 10);
-	if (*name && !*end && i >= -1 && i <= 255)
+	if (*name && (!*end || isspace(*end)) && i >= -1 && i <= 255)
 		return i;
 	return -2;
 }
-- 
1.5.4.1134.ge34cf-dirty
Previous: Timo HirvonenNext: Junio C Hamano
Message 5 of 8 in “Fix bug in parse_color that prevented the user from changing the background colors.”
  1. Fix bug in parse_color that prevented the user from changing the background colors.Chris Larson, Feb 5, 2008
  2. Timo HirvonenFeb 5, 2008
  3. Chris LarsonFeb 5, 2008
  4. Timo HirvonenFeb 5, 2008
  5. Fix parsing numeric color valuesTimo Hirvonen, Feb 5, 2008
  6. Junio C HamanoFeb 6, 2008
  7. Fix parsing numeric color valuesTimo Hirvonen, Feb 6, 2008
  8. Add tests for diff/status color parserTimo Hirvonen, Feb 6, 2008

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.