[gnome-desktop/wip/hadess/languages-fixes: 4/5] gnome-languages: Fix build time warning



commit 5bb2b0de5b60ca8ae8cfb575fa8fe7344343dd6e
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jul 15 13:46:45 2019 +0200

    gnome-languages: Fix build time warning
    
    libgnome-desktop/gnome-languages.c: In function ‘get_translated_language’:
    libgnome-desktop/gnome-languages.c:726:25: warning: ‘old_locale’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
      726 |                         uselocale (old_locale);
          |                         ^~~~~~~~~~~~~~~~~~~~~~
    libgnome-desktop/gnome-languages.c:727:25: warning: ‘loc’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
      727 |                         freelocale (loc);
          |                         ^~~~~~~~~~~~~~~~

 libgnome-desktop/gnome-languages.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c
index c4fc9be8..87da6f55 100644
--- a/libgnome-desktop/gnome-languages.c
+++ b/libgnome-desktop/gnome-languages.c
@@ -703,8 +703,8 @@ get_translated_language (const char *code,
         name = NULL;
         if (language != NULL) {
                 const char *translated_name;
-                locale_t loc;
-                locale_t old_locale;
+                locale_t loc = 0;
+                locale_t old_locale = 0;
 
                 if (locale != NULL) {
                         loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]