summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJean-Noel Avila <jn.avila@free.fr>2016-08-21 14:50:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-24 15:47:20 (GMT)
commit078fe30523f6361849a895999c04cf5f377a1656 (patch)
tree6fce54d4e33784dae77b7a3b4b4004e99023f78b /config.c
parent8aa6dc1d9e680448d53558ba2a1774481b30711a (diff)
downloadgit-078fe30523f6361849a895999c04cf5f377a1656.zip
git-078fe30523f6361849a895999c04cf5f377a1656.tar.gz
git-078fe30523f6361849a895999c04cf5f377a1656.tar.bz2
i18n: simplify numeric error reporting
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/config.c b/config.c
index 584cacf..0dfed68 100644
--- a/config.c
+++ b/config.c
@@ -652,46 +652,34 @@ int git_parse_ulong(const char *value, unsigned long *ret)
NORETURN
static void die_bad_number(const char *name, const char *value)
{
+ const char * error_type = (errno == ERANGE)? _("out of range"):_("invalid unit");
+
if (!value)
value = "";
if (!(cf && cf->name))
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s': out of range")
- : _("bad numeric config value '%s' for '%s': invalid unit"),
- value, name);
+ die(_("bad numeric config value '%s' for '%s': %s"),
+ value, name, error_type);
switch (cf->origin_type) {
case CONFIG_ORIGIN_BLOB:
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s' in blob %s: out of range")
- : _("bad numeric config value '%s' for '%s' in blob %s: invalid unit"),
- value, name, cf->name);
+ die(_("bad numeric config value '%s' for '%s' in blob %s: %s"),
+ value, name, cf->name, error_type);
case CONFIG_ORIGIN_FILE:
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s' in file %s: out of range")
- : _("bad numeric config value '%s' for '%s' in file %s: invalid unit"),
- value, name, cf->name);
+ die(_("bad numeric config value '%s' for '%s' in file %s: %s"),
+ value, name, cf->name, error_type);
case CONFIG_ORIGIN_STDIN:
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s' in standard input: out of range")
- : _("bad numeric config value '%s' for '%s' in standard input: invalid unit"),
- value, name);
+ die(_("bad numeric config value '%s' for '%s' in standard input: %s"),
+ value, name, error_type);
case CONFIG_ORIGIN_SUBMODULE_BLOB:
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s' in submodule-blob %s: out of range")
- : _("bad numeric config value '%s' for '%s' in submodule-blob %s: invalid unit"),
- value, name, cf->name);
+ die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"),
+ value, name, cf->name, error_type);
case CONFIG_ORIGIN_CMDLINE:
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s' in command line %s: out of range")
- : _("bad numeric config value '%s' for '%s' in command line %s: invalid unit"),
- value, name, cf->name);
+ die(_("bad numeric config value '%s' for '%s' in command line %s: %s"),
+ value, name, cf->name, error_type);
default:
- die(errno == ERANGE
- ? _("bad numeric config value '%s' for '%s' in %s: out of range")
- : _("bad numeric config value '%s' for '%s' in %s: invalid unit"),
- value, name, cf->name);
+ die(_("bad numeric config value '%s' for '%s' in %s: %s"),
+ value, name, cf->name, error_type);
}
}