summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a13ba1)
raw | patch | inline | side by side (parent: 9a13ba1)
author | Jeff King <peff@peff.net> | |
Thu, 21 Feb 2008 00:00:32 +0000 (19:00 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 21 Feb 2008 04:21:43 +0000 (20:21 -0800) |
These functions get called by other code, including parsing
config options from the command line. In that case,
config_file_name is NULL, leading to an ugly message or even
a segfault on some implementations of printf.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config options from the command line. In that case,
config_file_name is NULL, leading to an ugly message or even
a segfault on some implementations of printf.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c | patch | blob | history |
diff --git a/config.c b/config.c
index 8064cae18290d66ee69f1a56e501391ecb317b3d..cba2bcfb6722bb26ed80e8b7e5a50616cb4702e1 100644 (file)
--- a/config.c
+++ b/config.c
return 0;
}
+static void die_bad_config(const char *name)
+{
+ if (config_file_name)
+ die("bad config value for '%s' in %s", name, config_file_name);
+ die("bad config value for '%s'", name);
+}
+
int git_config_int(const char *name, const char *value)
{
long ret;
if (!git_parse_long(value, &ret))
- die("bad config value for '%s' in %s", name, config_file_name);
+ die_bad_config(name);
return ret;
}
{
unsigned long ret;
if (!git_parse_ulong(value, &ret))
- die("bad config value for '%s' in %s", name, config_file_name);
+ die_bad_config(name);
return ret;
}