[glib] gdatetime: Silence -Wmaybe-uninitialized



commit a7926117dde57d6408f292b54d9950b3a1f4cb79
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jul 26 11:34:02 2017 +0200

    gdatetime: Silence -Wmaybe-uninitialized
    
    GCC 6.3.1 thinks that tmp is being used uninitialized:
      gdatetime.c: In function ‘format_ampm’:
      gdatetime.c:2248:7: warning: ‘tmp’ may be used uninitialized in this
        function [-Wmaybe-uninitialized]
             g_free (tmp);
             ^~~~~~~~~~~~
    
    It is not an actual problem because the code in question is guarded by
    "if (!locale_is_utf8)" and "#if defined (HAVE_LANGINFO_TIME)", and it
    does get initialized under those circumstances. Still, it is a small
    price to pay for a cleaner build and having actual problems stand out
    more prominently.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785438

 glib/gdatetime.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index 745a32a..bad4ded 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -2220,7 +2220,7 @@ format_ampm (GDateTime *datetime,
              gboolean   uppercase)
 {
   const gchar *ampm;
-  gchar       *tmp, *ampm_dup;
+  gchar       *tmp = NULL, *ampm_dup;
   gsize        len;
 
   ampm = GET_AMPM (datetime);


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