From 2001273c289381bed89dbe541664b85da39ffc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Vaello=20Mart=C3=ADnez?= Date: Thu, 17 Dec 2015 14:00:07 +0100 Subject: [PATCH] Fix uninitialized variable In the 'icaltime_compare_with_current' function, the 'result' was uninitialized. As a consequence, this simplifies the if-else condition. https://bugzilla.gnome.org/show_bug.cgi?id=759588 --- src/gcal-utils.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/gcal-utils.c b/src/gcal-utils.c index 31775916..7969f288 100644 --- a/src/gcal-utils.c +++ b/src/gcal-utils.c @@ -417,7 +417,7 @@ icaltime_compare_with_current (const icaltimetype *date1, const icaltimetype *date2, time_t *current_time_t) { - gint result; + gint result = 0; time_t start1, start2, diff1, diff2; start1 = icaltime_as_timet_with_zone (*date1, date1->zone != NULL ? date1->zone : e_cal_util_get_system_timezone ()); @@ -425,11 +425,7 @@ icaltime_compare_with_current (const icaltimetype *date1, diff1 = start1 - *current_time_t; diff2 = start2 - *current_time_t; - if (diff1 == diff2) - { - result = 0; - } - else + if (diff1 != diff2) { if (diff1 == 0) result = -1;