From 8b1fb61df26649e1dec626ef9120fc787a831fcc Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 22 Oct 2007 23:52:55 -0500 Subject: Ensure all localization stuff is correctly guarded Anything dealing with libintl and localization should be correctly guarded inside an ENABLE_NLS block on both the pacman and libalpm sides. Signed-off-by: Dan McGee --- lib/libalpm/alpm.c | 3 +++ lib/libalpm/util.h | 2 ++ src/pacman/pacman.c | 5 ++++- src/pacman/util.h | 10 +++++----- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 20d4a746..7bbcc869 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -52,7 +52,10 @@ int SYMEXPORT alpm_initialize(void) if(handle == NULL) { RET_ERR(PM_ERR_MEMORY, -1); } + +#ifdef ENABLE_NLS bindtextdomain("libalpm", LOCALEDIR); +#endif return(0); } diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 3154f470..d8e6cbd8 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -25,6 +25,8 @@ #ifndef _ALPM_UTIL_H #define _ALPM_UTIL_H +#include "config.h" + #include #include #include diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 2f6f9280..705edafa 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -30,7 +30,6 @@ #include #include #include /* uname */ -#include /* bindtextdomain, textdomain */ #include /* setlocale */ #include /* time_t */ #if defined(PACMAN_DEBUG) && defined(HAVE_MTRACE) @@ -168,6 +167,7 @@ static void version(void) /** Sets up gettext localization. Safe to call multiple times. */ /* Inspired by the monotone function localize_monotone. */ +#if defined(ENABLE_NLS) static void localize(void) { static int init = 0; @@ -178,6 +178,7 @@ static void localize(void) init = 1; } } +#endif /** Set user agent environment variable. */ @@ -730,7 +731,9 @@ int main(int argc, char *argv[]) signal(SIGSEGV, cleanup); /* i18n init */ +#if defined(ENABLE_NLS) localize(); +#endif /* set user agent for downloading */ setuseragent(); diff --git a/src/pacman/util.h b/src/pacman/util.h index 876f8175..2814a780 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -24,20 +24,20 @@ #include #include #include -#include /* here so it doesn't need to be included elsewhere */ #include -/* update speed for the fill_progress based functions */ -#define UPDATE_SPEED_SEC 0.2f - -/* define _() as shortcut for gettext() */ #ifdef ENABLE_NLS +#include /* here so it doesn't need to be included elsewhere */ +/* define _() as shortcut for gettext() */ #define _(str) gettext(str) #else #define _(str) str #endif +/* update speed for the fill_progress based functions */ +#define UPDATE_SPEED_SEC 0.2f + int needs_transaction(); int getcols(); int makepath(const char *path); -- cgit v1.2.3-70-g09d2