diff.c: factor out diff_flush_patch_all_file_pairs
[gitweb.git] / color.c
diff --git a/color.c b/color.c
index 7bb4a96f8c1dfb0b5769829a133cd8a86d8beee6..31b6207a00de42a386e98c5656209ea7a010abe4 100644 (file)
--- a/color.c
+++ b/color.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 #include "color.h"
 
 static int git_use_color_default = GIT_COLOR_AUTO;
@@ -212,8 +213,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 +226,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])) {