Skip to content

Commit 2e43cd4

Browse files
avargitster
authored andcommitted
config.c: refactor die_bad_number() to not call gettext() early
Prepare die_bad_number() for a change to specially handle GIT_TEST_GETTEXT_POISON calling git_env_bool() by making die_bad_number() not call gettext() early, which would in turn call git_env_bool(). There's no meaningful change here yet, just a re-arrangement of the current code to make that subsequent change easier to read. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b4f207f commit 2e43cd4

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

config.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -949,34 +949,35 @@ int git_parse_ssize_t(const char *value, ssize_t *ret)
949949
NORETURN
950950
static void die_bad_number(const char *name, const char *value)
951951
{
952-
const char * error_type = (errno == ERANGE)? _("out of range"):_("invalid unit");
952+
const char *error_type = (errno == ERANGE) ?
953+
N_("out of range") : N_("invalid unit");
954+
const char *bad_numeric = N_("bad numeric config value '%s' for '%s': %s");
953955

954956
if (!value)
955957
value = "";
956958

957959
if (!(cf && cf->name))
958-
die(_("bad numeric config value '%s' for '%s': %s"),
959-
value, name, error_type);
960+
die(_(bad_numeric), value, name, _(error_type));
960961

961962
switch (cf->origin_type) {
962963
case CONFIG_ORIGIN_BLOB:
963964
die(_("bad numeric config value '%s' for '%s' in blob %s: %s"),
964-
value, name, cf->name, error_type);
965+
value, name, cf->name, _(error_type));
965966
case CONFIG_ORIGIN_FILE:
966967
die(_("bad numeric config value '%s' for '%s' in file %s: %s"),
967-
value, name, cf->name, error_type);
968+
value, name, cf->name, _(error_type));
968969
case CONFIG_ORIGIN_STDIN:
969970
die(_("bad numeric config value '%s' for '%s' in standard input: %s"),
970-
value, name, error_type);
971+
value, name, _(error_type));
971972
case CONFIG_ORIGIN_SUBMODULE_BLOB:
972973
die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"),
973-
value, name, cf->name, error_type);
974+
value, name, cf->name, _(error_type));
974975
case CONFIG_ORIGIN_CMDLINE:
975976
die(_("bad numeric config value '%s' for '%s' in command line %s: %s"),
976-
value, name, cf->name, error_type);
977+
value, name, cf->name, _(error_type));
977978
default:
978979
die(_("bad numeric config value '%s' for '%s' in %s: %s"),
979-
value, name, cf->name, error_type);
980+
value, name, cf->name, _(error_type));
980981
}
981982
}
982983

0 commit comments

Comments
 (0)