Merge branch 'jk/daemon-tolower'
* jk/daemon-tolower: daemon/config: factor out duplicate xstrdup_tolower
This commit is contained in:
13
strbuf.c
13
strbuf.c
@ -563,3 +563,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