summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDave Borowitz <dborowitz@google.com>2015-08-19 15:26:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-19 19:43:22 (GMT)
commit9a549d4397a624a819e881137c519d0ca61fe7e8 (patch)
treefebb1cc17a5f6c8a1048e264adfabaf68d15bbd7 /config.c
parent87c0d08b3d92c55c233c8a95294a2232a97d97eb (diff)
downloadgit-9a549d4397a624a819e881137c519d0ca61fe7e8.zip
git-9a549d4397a624a819e881137c519d0ca61fe7e8.tar.gz
git-9a549d4397a624a819e881137c519d0ca61fe7e8.tar.bz2
config.c: rename git_config_maybe_bool_text and export it as git_parse_maybe_bool
This helper function does not complain about the config variable but just silently reports failure to the caller. It is useful for callers that need to parse any string that could be boolean or other string (e.g. tristate yes/no/auto). Signed-off-by: Dave Borowitz <dborowitz@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/config.c b/config.c
index 27a73c8..bc6b89d 100644
--- a/config.c
+++ b/config.c
@@ -618,7 +618,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
return ret;
}
-static int git_config_maybe_bool_text(const char *name, const char *value)
+int git_parse_maybe_bool(const char *value)
{
if (!value)
return 1;
@@ -637,7 +637,7 @@ static int git_config_maybe_bool_text(const char *name, const char *value)
int git_config_maybe_bool(const char *name, const char *value)
{
- int v = git_config_maybe_bool_text(name, value);
+ int v = git_parse_maybe_bool(value);
if (0 <= v)
return v;
if (git_parse_int(value, &v))
@@ -647,7 +647,7 @@ int git_config_maybe_bool(const char *name, const char *value)
int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
{
- int v = git_config_maybe_bool_text(name, value);
+ int v = git_parse_maybe_bool(value);
if (0 <= v) {
*is_bool = 1;
return v;