daemon/config: factor out duplicate xstrdup_tolower
We have two implementations of the same function; let's drop that to one. We take the name from daemon.c, but the implementation (which is just slightly more efficient) from the config code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
7bbc4e8fdb
commit
88d5a6f6cd
13
strbuf.c
13
strbuf.c
@ -570,3 +570,16 @@ int fprintf_ln(FILE *fp, const char *fmt, ...)
|
||||
return -1;
|
||||
return ret + 1;
|
||||
}
|
||||
|
||||
char *xstrdup_tolower(const char *string)
|
||||
{
|
||||
char *result;
|
||||
size_t len, i;
|
||||
|
||||
len = strlen(string);
|
||||
result = xmalloc(len + 1);
|
||||
for (i = 0; i < len; i++)
|
||||
result[i] = tolower(string[i]);
|
||||
result[i] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user