From 5acee27d5d25bdf9ae42a157856cf12f871494ea Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Jul 2014 21:22:26 +0900 Subject: [PATCH] localename: Enforce declarations before statements. * localename.c (gl_locale_name_thread): Declare 'lcid' before the first statement. --- ChangeLog | 6 ++++++ lib/localename.c | 15 ++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd702dd548..73a6c0369b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-07-19 Eli Zaretskii + + localename: Enforce declarations before statements. + * localename.c (gl_locale_name_thread): Declare 'lcid' before the + first statement. + 2014-07-18 Jim Meyering test-userspec: don't look up numeric user names diff --git a/lib/localename.c b/lib/localename.c index bcef8a08ca..4cce060efd 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -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; } -- 2.39.5