From 4bc75337f31374b7424d7bdebf839dd91ec80c0a Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 28 Jul 2015 17:38:44 +0200 Subject: [PATCH] common,w32: Avoid unused var warning about msgcache. * common/i18n.c (USE_MSGCACHE): New. (msgcache) [!USE_MSGCACHE]: Do not define. (i18n_localegettext): Repalce #if conditions by USE_MSGCACHE. Signed-off-by: Werner Koch --- common/i18n.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/common/i18n.c b/common/i18n.c index d1f157c20..39e3d8fcc 100644 --- a/common/i18n.c +++ b/common/i18n.c @@ -38,8 +38,16 @@ #include "i18n.h" -/* An object to store pointers to static strings and there static - translation. A linked list is not optimal but given that we only +#undef USE_MSGCACHE +#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES) \ + && !defined(USE_SIMPLE_GETTEXT) && defined(ENABLE_NLS) +# define USE_MSGCACHE 1 +#endif + + +#ifdef USE_MSGCACHE +/* An object to store pointers to static strings and their static + translations. A linked list is not optimal but given that we only have a few dozen messages it should be acceptable. */ struct msg_cache_s { @@ -67,6 +75,7 @@ struct msg_cache_heads_s static strings. */ static struct msg_cache_heads_s *msgcache; +#endif /*USE_MSGCACHE*/ void @@ -153,8 +162,7 @@ i18n_utf8 (const char *string) const char * i18n_localegettext (const char *lc_messages, const char *string) { -#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES) \ - && !defined(USE_SIMPLE_GETTEXT) && defined(ENABLE_NLS) +#if USE_MSGCACHE const char *result = NULL; char *saved = NULL; struct msg_cache_heads_s *mh; @@ -220,8 +228,10 @@ i18n_localegettext (const char *lc_messages, const char *string) xfree (saved); return result? result : _(string); -#else /*!(HAVE_SETLOCALE && LC_MESSAGES ...)*/ +#else /*!USE_MSGCACHE*/ + (void)lc_messages; return _(string); -#endif /*!(HAVE_SETLOCALE && LC_MESSAGES ...)*/ + +#endif /*!USE_MSGCACHE*/ }