From: Jean-Noel Avila <jn.avila@free.fr>
To: git@vger.kernel.org
Cc: Jean-Noel Avila <jn.avila@free.fr>
Subject: [PATCH 3/3] i18n: simplify numeric error reporting
Date: Sun, 21 Aug 2016 16:50:39 +0200 [thread overview]
Message-ID: <20160821145039.12121-3-jn.avila@free.fr> (raw)
In-Reply-To: <20160821145039.12121-1-jn.avila@free.fr>
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
---
config.c | 43 +++++++++++++++----------------------------
1 file changed, 15 insertions(+), 28 deletions(-)
diff --git a/config.c b/config.c
index 584cacf..e33c703 100644
--- a/config.c
+++ b/config.c
@@ -655,43 +655,30 @@ static void die_bad_number(const char *name, const char *value)
if (!value)
value = "";
+ const char * error_type = (errno == ERANGE)? _("out of range"):_("invalid unit");
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);
}
}
--
2.10.0.rc0.37.gd7d1c14.dirty
next prev parent reply other threads:[~2016-08-21 14:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 15:04 [L10N] Kickoff of translation for Git 2.10.0 round 1 Jiang Xin
2016-08-20 16:01 ` Jean-Noël AVILA
2016-08-20 18:03 ` Junio C Hamano
2016-08-20 18:38 ` Jean-Noël AVILA
2016-08-21 15:45 ` Jiang Xin
2016-08-23 15:58 ` Junio C Hamano
2016-08-23 18:16 ` Jean-Noël AVILA
2016-08-21 14:50 ` [PATCH 1/3] i18n: fix typos for translation Jean-Noel Avila
2016-08-21 14:50 ` [PATCH 2/3] i18n: fix git rebase interactive commit messages Jean-Noel Avila
2016-08-21 14:50 ` Jean-Noel Avila [this message]
2016-08-24 15:48 ` [PATCH 3/3] i18n: simplify numeric error reporting Junio C Hamano
2016-08-23 16:06 ` [PATCH 1/3] i18n: fix typos for translation Junio C Hamano
2016-08-24 15:44 ` Junio C Hamano
2016-08-24 15:45 ` Junio C Hamano
2016-08-25 5:24 ` [L10N] Kickoff of translation for Git 2.10.0 round 1 Alex Henrie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160821145039.12121-3-jn.avila@free.fr \
--to=jn.avila@free.fr \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).