From patchwork Fri Jun 21 10:18:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11009683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76AE36C5 for ; Fri, 21 Jun 2019 10:18:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65D9C289D0 for ; Fri, 21 Jun 2019 10:18:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59F3E289E8; Fri, 21 Jun 2019 10:18:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F07DB289EF for ; Fri, 21 Jun 2019 10:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726549AbfFUKSc (ORCPT ); Fri, 21 Jun 2019 06:18:32 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33459 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbfFUKSb (ORCPT ); Fri, 21 Jun 2019 06:18:31 -0400 Received: by mail-wr1-f67.google.com with SMTP id n9so6066144wru.0 for ; Fri, 21 Jun 2019 03:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NpzDRG0kZJ9YtaYBUv3fvBA5IBhs5BLuVYzXtQLF3yY=; b=TEAjjrkN48bgHtaSmSs4AkLqmReXY0MFc3iWxyfRWAOP/MSDWvSa0K5faCIGyKGfB1 edmOGkuOmBBIZ/Yoo7Cgq2OrfZ4CxgLvsKEPtNCPv/fFpVrNbvnc7dPNm1zCT3ynvS6H OyKc70wjqa9r2HmaI1T0klp2W3RH4InxvvkEifPYdNTiQupD3hLXzkzcFdKLzAvTQ7j0 Pg3y3wwyEJYhQFjpqnUx7vas3dZEgsomLlvR0H/TDFCkzd3yrZmLrpMSGcBL3Lf0EteE J0zlDXeFCJ72mbcrguIuHpZEXQbfvuvrDtrvIlQR9K6dhwCHe3TiYx17Yyp8wUYeBr1l Q3ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NpzDRG0kZJ9YtaYBUv3fvBA5IBhs5BLuVYzXtQLF3yY=; b=lgiQblq/LbLltS7CodDEpAgNTDUVjO34XF6TQzhCXrD20kTMjDj/QmNUawv8ES92p/ s4PAPlIxeC7m3gaXOl3YUSlatgMv8RFoh+WfaZCSKSzfuFw20AU1rl3dpH1BBgLa2GxN asItYo7K/Ise3Gx330uMgUZOSwTb0egsaD1L8GmKElUk3yBSYgIOSxVSJEohl76olGII cYBMRaH0mHWe0sATYlR5kEu1N9sIktCNCsgOeTgYqveEGCRxXjPpMQfr4A0oAZ7TisMh H37UtQhk50d/Z2XVFK3+9X4SzLhwqmA1JLV+4FShB0c2YElUz8Zf2VUe9c29s42rxaqP Vr4Q== X-Gm-Message-State: APjAAAWvmoE6blX70IIMonytjguMXft8K8cwxIA+qvUqqoy136nz3Yaj ga/g8r+SgcNkXas2BJ+lqIVv3NKs3WE= X-Google-Smtp-Source: APXvYqxVuT7fTrkZgenX/CPa+14xolBD6f9kwsCFSSV/aE3F/oRsPFxcdsMvaeME7PclxVS7rCH7GA== X-Received: by 2002:adf:f050:: with SMTP id t16mr76814725wro.99.1561112309140; Fri, 21 Jun 2019 03:18:29 -0700 (PDT) Received: from vm.nix.is ([2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id y184sm1878193wmg.14.2019.06.21.03.18.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 03:18:27 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?Tmd1eeG7hW4gVGjDoWkgTmc=?= =?utf-8?b?4buNYyBEdXk=?= , Jeff King , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v3 3/8] config.c: refactor die_bad_number() to not call gettext() early Date: Fri, 21 Jun 2019 12:18:07 +0200 Message-Id: <20190621101812.27300-4-avarab@gmail.com> X-Mailer: git-send-email 2.22.0.455.g172b71a6c5 In-Reply-To: <20190620210915.11297-1-avarab@gmail.com> References: <20190620210915.11297-1-avarab@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- config.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/config.c b/config.c index 296a6d9cc4..374cb33005 100644 --- a/config.c +++ b/config.c @@ -949,34 +949,35 @@ int git_parse_ssize_t(const char *value, ssize_t *ret) NORETURN static void die_bad_number(const char *name, const char *value) { - const char * error_type = (errno == ERANGE)? _("out of range"):_("invalid unit"); + const char *error_type = (errno == ERANGE) ? + N_("out of range") : N_("invalid unit"); + const char *bad_numeric = N_("bad numeric config value '%s' for '%s': %s"); if (!value) value = ""; if (!(cf && cf->name)) - die(_("bad numeric config value '%s' for '%s': %s"), - value, name, error_type); + die(_(bad_numeric), value, name, _(error_type)); switch (cf->origin_type) { case CONFIG_ORIGIN_BLOB: die(_("bad numeric config value '%s' for '%s' in blob %s: %s"), - value, name, cf->name, error_type); + value, name, cf->name, _(error_type)); case CONFIG_ORIGIN_FILE: die(_("bad numeric config value '%s' for '%s' in file %s: %s"), - value, name, cf->name, error_type); + value, name, cf->name, _(error_type)); case CONFIG_ORIGIN_STDIN: die(_("bad numeric config value '%s' for '%s' in standard input: %s"), - value, name, error_type); + value, name, _(error_type)); case CONFIG_ORIGIN_SUBMODULE_BLOB: die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"), - value, name, cf->name, error_type); + value, name, cf->name, _(error_type)); case CONFIG_ORIGIN_CMDLINE: die(_("bad numeric config value '%s' for '%s' in command line %s: %s"), - value, name, cf->name, error_type); + value, name, cf->name, _(error_type)); default: die(_("bad numeric config value '%s' for '%s' in %s: %s"), - value, name, cf->name, error_type); + value, name, cf->name, _(error_type)); } }