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
This commit is contained in:
Debarshi Ray 2017-07-26 11:34:02 +02:00
parent 528a1b9288
commit a7926117dd

View File

@ -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);