[vlc-devel] commit: Use ifdef's to guard against setlocale() in vlc-cache-gen ( Pierre Ynard )

git version control git at videolan.org
Tue Jan 26 14:38:59 CET 2010


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Jan 26 14:35:49 2010 +0100| [54a847e61499d93ba027fa73ec5715aadd96d2f0] | committer: Pierre Ynard 

Use ifdef's to guard against setlocale() in vlc-cache-gen

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=54a847e61499d93ba027fa73ec5715aadd96d2f0
---

 bin/cachegen.c |    7 ++++++-
 configure.ac   |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/bin/cachegen.c b/bin/cachegen.c
index 5792ea1..17f01a3 100644
--- a/bin/cachegen.c
+++ b/bin/cachegen.c
@@ -25,7 +25,10 @@
 #include <vlc/vlc.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <locale.h>
+
+#ifdef HAVE_SETLOCALE
+# include <locale.h>
+#endif
 
 #ifdef HAVE_GETOPT_H
 # include <getopt.h>
@@ -56,7 +59,9 @@ int main (int argc, char *argv[])
         { NULL,         no_argument,       NULL, '\0'}
     };
 
+#ifdef HAVE_SETLOCALE
     setlocale (LC_CTYPE, ""); /* needed by FromLocale() */
+#endif
 
     int c;
     while ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1)
diff --git a/configure.ac b/configure.ac
index 0ee70dc..b40e236 100644
--- a/configure.ac
+++ b/configure.ac
@@ -562,7 +562,7 @@ dnl Check for system libs needed
 need_libc=false
 
 dnl Check for usual libc functions
-AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fork getenv getpwuid_r gettimeofday isatty lstat memalign posix_fadvise posix_madvise posix_memalign putenv setenv stricmp strnicmp tdestroy uselocale])
+AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fork getenv getpwuid_r gettimeofday isatty lstat memalign posix_fadvise posix_madvise posix_memalign putenv setenv setlocale stricmp strnicmp tdestroy uselocale])
 AC_REPLACE_FUNCS([asprintf atof atoll getcwd getpid gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab vasprintf])
 AC_CHECK_FUNCS(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])




More information about the vlc-devel mailing list