提交 bc407565 编写于 作者: N Nguyễn Thái Ngọc Duy 提交者: Junio C Hamano

color.c: trim leading spaces in color_parse_mem()

Normally color_parse_mem() is called from config parser which trims the
leading spaces already. The new caller in the next patch won't. Let's be
tidy and trim leading spaces too (we already trim trailing spaces
after a word).
Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c2f41bf5
......@@ -207,10 +207,15 @@ int color_parse_mem(const char *value, int value_len, char *dst)
struct color fg = { COLOR_UNSPECIFIED };
struct color bg = { COLOR_UNSPECIFIED };
while (len > 0 && isspace(*ptr)) {
ptr++;
len--;
}
if (!len)
return -1;
if (!strncasecmp(value, "reset", len)) {
if (!strncasecmp(ptr, "reset", len)) {
xsnprintf(dst, end - dst, GIT_COLOR_RESET);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册