skip_prefix: add case-insensitive variant
[gitweb.git] / color.c
diff --git a/color.c b/color.c
index 7bb4a96f8c1dfb0b5769829a133cd8a86d8beee6..dee61557e03f452f1e20ce6c8c467203aa8aed60 100644 (file)
--- a/color.c
+++ b/color.c
@@ -212,8 +212,10 @@ int color_parse_mem(const char *value, int value_len, char *dst)
                len--;
        }
 
-       if (!len)
-               return -1;
+       if (!len) {
+               dst[0] = '\0';
+               return 0;
+       }
 
        if (!strncasecmp(ptr, "reset", len)) {
                xsnprintf(dst, end - dst, GIT_COLOR_RESET);
@@ -223,7 +225,7 @@ int color_parse_mem(const char *value, int value_len, char *dst)
        /* [fg [bg]] [attr]... */
        while (len > 0) {
                const char *word = ptr;
-               struct color c;
+               struct color c = { COLOR_UNSPECIFIED };
                int val, wordlen = 0;
 
                while (len > 0 && !isspace(word[wordlen])) {