]> Savannah Git Hosting - gnulib.git/commitdiff
localename: Enforce declarations before statements.
authorEli Zaretskii <eliz@gnu.org>
Sat, 19 Jul 2014 12:22:26 +0000 (21:22 +0900)
committerDaiki Ueno <ueno@gnu.org>
Sat, 19 Jul 2014 12:23:11 +0000 (21:23 +0900)
* localename.c (gl_locale_name_thread): Declare 'lcid' before the
first statement.

ChangeLog
lib/localename.c

index cd702dd548f6a872e87bb741cc0d754b67c93c8d..73a6c0369bd8eb224db0150d7adb9b1beae80291 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-19  Eli Zaretskii  <eliz@gnu.org>
+
+       localename: Enforce declarations before statements.
+       * localename.c (gl_locale_name_thread): Declare 'lcid' before the
+       first statement.
+
 2014-07-18  Jim Meyering  <meyering@fb.com>
 
        test-userspec: don't look up numeric user names
index bcef8a08caf078b9df202d92853c1f9fc49473e0..4cce060efd4396a95bd245d91b85e65568f7c1dc 100644 (file)
@@ -2730,6 +2730,7 @@ gl_locale_name_thread (int category, const char *categoryname)
   if (LC_MIN <= category && category <= LC_MAX)
     {
       char *locname = setlocale (category, NULL);
+      LCID lcid = 0;
 
       /* If CATEGORY is LC_ALL, the result might be a semi-colon
         separated list of locales.  We need only one, so we take the
@@ -2738,14 +2739,14 @@ gl_locale_name_thread (int category, const char *categoryname)
       if (strchr (locname, ';'))
        locname = setlocale (LC_CTYPE, NULL);
 
-    /* Convert locale name to LCID.  We don't want to use
-       LocaleNameToLCID because (a) it is only available since Vista,
-       and (b) it doesn't accept locale names returned by 'setlocale'.  */
-    LCID lcid = get_lcid (locname);
+      /* Convert locale name to LCID.  We don't want to use
+         LocaleNameToLCID because (a) it is only available since Vista,
+         and (b) it doesn't accept locale names returned by 'setlocale'.  */
+      lcid = get_lcid (locname);
 
-    if (lcid > 0)
-      return gl_locale_name_from_win32_LCID (lcid);
-  }
+      if (lcid > 0)
+        return gl_locale_name_from_win32_LCID (lcid);
+    }
 #endif
   return NULL;
 }