[glib] gdatetime: Fix a spurious gcc warning
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gdatetime: Fix a spurious gcc warning
- Date: Fri, 13 Apr 2018 14:23:31 +0000 (UTC)
commit a80117c371f726545e2dcde8dd63268cd675b26d
Author: Philip Withnall <withnall endlessm com>
Date: Thu Apr 12 13:19:21 2018 +0100
gdatetime: Fix a spurious gcc warning
It’s possible to get a -Wmaybe-uninitialized warning out of this code
with some GCC versions. Rework the code to avoid needing the conditional
free.
Signed-off-by: Philip Withnall <withnall endlessm com>
https://bugzilla.gnome.org/show_bug.cgi?id=728108
glib/gdatetime.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index f3ad02d86..0820e0d8b 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -3197,6 +3197,7 @@ g_date_time_format_locale (GDateTime *datetime,
break;
case 'Z':
tz = g_date_time_get_timezone_abbreviation (datetime);
+ tmp = NULL;
tmp_len = strlen (tz);
if (!locale_is_utf8)
{
@@ -3205,8 +3206,7 @@ g_date_time_format_locale (GDateTime *datetime,
return FALSE;
}
g_string_append_len (outstr, tz, tmp_len);
- if (!locale_is_utf8)
- g_free (tmp);
+ g_free (tmp);
break;
case '%':
g_string_append_c (outstr, '%');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]