diff options
author | Jeff King <peff@peff.net> | 2014-05-22 05:44:09 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-23 12:39:44 -0700 |
commit | 88d5a6f6cd1b63e1637027322cdfdbeefe38c3ed (patch) | |
tree | 5bb6adf34ea3a774df7f1645bf9de485542ef028 /builtin/config.c | |
parent | Git 1.8.5.5 (diff) | |
download | tgif-88d5a6f6cd1b63e1637027322cdfdbeefe38c3ed.tar.xz |
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>
Diffstat (limited to 'builtin/config.c')
-rw-r--r-- | builtin/config.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/builtin/config.c b/builtin/config.c index 20e89fe4e0..00b0c240fc 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -396,19 +396,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; @@ -423,7 +410,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'; |