color.h: document and modernize header

Add documentation explaining the functions in color.h.
While at it, migrate the function `color_set` into grep.c,
where the only callers are.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller
2018-02-12 17:41:30 -08:00
committed by Junio C Hamano
parent 8279ed033f
commit 75e5e9c3f7
3 changed files with 34 additions and 12 deletions

View File

@ -161,11 +161,6 @@ int color_parse(const char *value, char *dst)
return color_parse_mem(value, strlen(value), dst);
}
void color_set(char *dst, const char *color_bytes)
{
xsnprintf(dst, COLOR_MAXLEN, "%s", color_bytes);
}
/*
* Write the ANSI color codes for "c" to "out"; the string should
* already have the ANSI escape code in it. "out" should have enough
@ -399,8 +394,6 @@ static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
return r;
}
int color_fprintf(FILE *fp, const char *color, const char *fmt, ...)
{
va_list args;