From 78335417a01caa3c079afe24258efcf4875820ee Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 5 Jan 2010 14:14:23 +0200 Subject: [PATCH] Sanitize i18nTag() when NLS disabled - if NLS is disabled, the whole thing becomes just a plain old headerGet() --- lib/tagexts.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/tagexts.c b/lib/tagexts.c index 3c109e8..dc0e0fb 100644 --- a/lib/tagexts.c +++ b/lib/tagexts.c @@ -478,8 +478,9 @@ static const char * const _macro_i18ndomains = "%{?_i18ndomains}"; */ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags) { - char * dstring = rpmExpand(_macro_i18ndomains, NULL); int rc; +#if defined(ENABLE_NLS) + char * dstring = rpmExpand(_macro_i18ndomains, NULL); td->type = RPM_STRING_TYPE; td->data = NULL; @@ -497,9 +498,7 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags) /* change to en_US for msgkey -> msgid resolution */ langval = getenv(language); (void) setenv(language, "en_US", 1); -#if defined(ENABLE_NLS) ++_nl_msg_cat_cntr; -#endif msgid = NULL; for (domain = dstring; domain != NULL; domain = de) { @@ -514,9 +513,7 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags) (void) setenv(language, langval, 1); else unsetenv(language); -#if defined(ENABLE_NLS) ++_nl_msg_cat_cntr; -#endif if (domain && msgid) { td->data = dgettext(domain, msgid); @@ -531,6 +528,7 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags) } dstring = _free(dstring); +#endif rc = headerGet(h, tag, td, HEADERGET_ALLOC); return rc; -- 2.7.4