[gnome-calendar] Fix uninitialized variable



commit 2001273c289381bed89dbe541664b85da39ffc34
Author: Miguel Vaello Martínez <miguel vaellomartinez gmail com>
Date:   Thu Dec 17 14:00:07 2015 +0100

    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 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/gcal-utils.c b/src/gcal-utils.c
index 3177591..7969f28 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;


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