summaryrefslogtreecommitdiff
path: root/color.c
diff options
context:
space:
mode:
authorArjen Laarhoven <arjen@yaph.org>2009-02-13 22:53:40 +0100
committerJunio C Hamano <gitster@pobox.com>2009-02-13 17:27:58 -0800
commitdc6ebd4cc5028d59146e02e30f7945ee91974e6e (patch)
tree6028f6a7a3e2baf7b24bde5cd2819c148f0a3c68 /color.c
parent5cd12b85fe8ff74f202a158511ead34e8aba584c (diff)
downloadgit-dc6ebd4cc5028d59146e02e30f7945ee91974e6e.tar.gz
Clean up use of ANSI color sequences
Remove the literal ANSI escape sequences and replace them by readable constants. Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'color.c')
-rw-r--r--color.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/color.c b/color.c
index db4dccfb77..62977f4808 100644
--- a/color.c
+++ b/color.c
@@ -1,8 +1,6 @@
#include "cache.h"
#include "color.h"
-#define COLOR_RESET "\033[m"
-
int git_use_color_default = 0;
static int parse_color(const char *name, int len)
@@ -54,7 +52,7 @@ void color_parse_mem(const char *value, int value_len, const char *var,
int bg = -2;
if (!strncasecmp(value, "reset", len)) {
- strcpy(dst, "\033[m");
+ strcpy(dst, GIT_COLOR_RESET);
return;
}
@@ -175,7 +173,7 @@ static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
r += fprintf(fp, "%s", color);
r += vfprintf(fp, fmt, args);
if (*color)
- r += fprintf(fp, "%s", COLOR_RESET);
+ r += fprintf(fp, "%s", GIT_COLOR_RESET);
if (trail)
r += fprintf(fp, "%s", trail);
return r;
@@ -217,7 +215,7 @@ int color_fwrite_lines(FILE *fp, const char *color,
char *p = memchr(buf, '\n', count);
if (p != buf && (fputs(color, fp) < 0 ||
fwrite(buf, p ? p - buf : count, 1, fp) != 1 ||
- fputs(COLOR_RESET, fp) < 0))
+ fputs(GIT_COLOR_RESET, fp) < 0))
return -1;
if (!p)
return 0;