From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id A52E8386F83F for ; Wed, 16 Dec 2020 09:54:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A52E8386F83F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ldv@altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 30D6372C8B5 for ; Wed, 16 Dec 2020 12:54:18 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 242557CC819; Wed, 16 Dec 2020 12:54:18 +0300 (MSK) Date: Wed, 16 Dec 2020 12:54:18 +0300 From: "Dmitry V. Levin" To: elfutils-devel@sourceware.org Subject: [PATCH 2/4] lib: consistently use _(Str) instead of gettext(Str) Message-ID: <20201216095417.GB26456@altlinux.org> References: <20201216014759.GA21292@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201216014759.GA21292@altlinux.org> X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 09:54:20 -0000 eu-config.h defines _(Str) to dgettext ("elfutils", Str) instead of a simple gettext (Str) for a reason: the library might be indirectly used by clients that called bindtextdomain with a domain different from "elfutils". The change was made automatically using the following command: $ git grep -l '\ --- lib/ChangeLog | 5 +++++ lib/color.c | 4 ++-- lib/printversion.c | 2 +- lib/system.h | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 48b496ce..3b603bd0 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,10 @@ 2020-12-16 Dmitry V. Levin + * color.c (parse_opt): Replace gettext(...) and + dgettext("elfutils, ...) with _(...). + * printversion.c (print_version): Replace gettext(...) with _(...). + * system.h (sgettext): Likewise. + * eu-config.h (_): New macro. * xmalloc.c (_): Remove. diff --git a/lib/color.c b/lib/color.c index 2cb41eba..454cb7ca 100644 --- a/lib/color.c +++ b/lib/color.c @@ -126,7 +126,7 @@ parse_opt (int key, char *arg, } if (i == nvalues) { - error (0, 0, dgettext ("elfutils", "\ + error (0, 0, _("\ %s: invalid argument '%s' for '--color'\n\ valid arguments are:\n\ - 'always', 'yes', 'force'\n\ @@ -191,7 +191,7 @@ valid arguments are:\n\ if (asprintf (known[i].varp, "\e[%.*sm", (int) (env - val), val) < 0) error (EXIT_FAILURE, errno, - gettext ("cannot allocate memory")); + _("cannot allocate memory")); break; } } diff --git a/lib/printversion.c b/lib/printversion.c index 28981d20..1f3f3d19 100644 --- a/lib/printversion.c +++ b/lib/printversion.c @@ -37,7 +37,7 @@ void print_version (FILE *stream, struct argp_state *state) { fprintf (stream, "%s (%s) %s\n", state->name, PACKAGE_NAME, PACKAGE_VERSION); - fprintf (stream, gettext ("\ + fprintf (stream, _("\ Copyright (C) %s The elfutils developers <%s>.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ diff --git a/lib/system.h b/lib/system.h index 7b650f11..1c478e1c 100644 --- a/lib/system.h +++ b/lib/system.h @@ -71,7 +71,7 @@ /* A special gettext function we use if the strings are too short. */ #define sgettext(Str) \ - ({ const char *__res = strrchr (gettext (Str), '|'); \ + ({ const char *__res = strrchr (_(Str), '|'); \ __res ? __res + 1 : Str; }) #define gettext_noop(Str) Str -- ldv