1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-21 12:46:09 +02:00

Merge branch 'jk/daemon-tolower'

* jk/daemon-tolower:
  daemon/config: factor out duplicate xstrdup_tolower
This commit is contained in:
Junio C Hamano 2014-06-16 10:07:14 -07:00
commit b4516df9b8
4 changed files with 16 additions and 22 deletions

View File

@ -395,19 +395,6 @@ static int urlmatch_collect_fn(const char *var, const char *value, void *cb)
return 0;
}
static char *dup_downcase(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;
}
static int get_urlmatch(const char *var, const char *url)
{
char *section_tail;
@ -422,7 +409,7 @@ static int get_urlmatch(const char *var, const char *url)
if (!url_normalize(url, &config.url))
die("%s", config.url.err);
config.section = dup_downcase(var);
config.section = xstrdup_tolower(var);
section_tail = strchr(config.section, '.');
if (section_tail) {
*section_tail = '\0';

View File

@ -475,14 +475,6 @@ static void make_service_overridable(const char *name, int ena)
die("No such service %s", name);
}
static char *xstrdup_tolower(const char *str)
{
char *p, *dup = xstrdup(str);
for (p = dup; *p; p++)
*p = tolower(*p);
return dup;
}
static void parse_host_and_port(char *hostport, char **host,
char **port)
{

View File

@ -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;
}

View File

@ -183,4 +183,6 @@ extern int printf_ln(const char *fmt, ...);
__attribute__((format (printf,2,3)))
extern int fprintf_ln(FILE *fp, const char *fmt, ...);
char *xstrdup_tolower(const char *);
#endif /* STRBUF_H */