[almanah] Replace null_safe_strcmp() with g_strcmp0() in calendar client



commit f49de61e500dfe7f02319ea55b20437f76bf2a1c
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun May 2 23:28:53 2010 +0100

    Replace null_safe_strcmp() with g_strcmp0() in calendar client

 src/event-factories/calendar-client.c |   37 +++++++++++++-------------------
 1 files changed, 15 insertions(+), 22 deletions(-)
---
diff --git a/src/event-factories/calendar-client.c b/src/event-factories/calendar-client.c
index ba7d132..6f4f438 100644
--- a/src/event-factories/calendar-client.c
+++ b/src/event-factories/calendar-client.c
@@ -771,13 +771,6 @@ get_source_uri (ECal *esource)
     return NULL;
 }
 
-static inline int
-null_safe_strcmp (const char *a,
-		  const char *b)
-{
-  return (!a && !b) ? 0 : (a && !b) || (!a && b) ? 1 : strcmp (a, b);
-}
-
 static inline gboolean
 calendar_appointment_equal (CalendarAppointment *a,
 			    CalendarAppointment *b)
@@ -798,13 +791,13 @@ calendar_appointment_equal (CalendarAppointment *a,
     }
 
   return
-    null_safe_strcmp (a->uid,          b->uid)          == 0 &&
-    null_safe_strcmp (a->uri,          b->uri)          == 0 &&
-    null_safe_strcmp (a->summary,      b->summary)      == 0 &&
-    null_safe_strcmp (a->description,  b->description)  == 0 &&
-    null_safe_strcmp (a->color_string, b->color_string) == 0 &&
-    a->start_time == b->start_time                         &&
-    a->end_time   == b->end_time                           &&
+    g_strcmp0 (a->uid,          b->uid)          == 0 &&
+    g_strcmp0 (a->uri,          b->uri)          == 0 &&
+    g_strcmp0 (a->summary,      b->summary)      == 0 &&
+    g_strcmp0 (a->description,  b->description)  == 0 &&
+    g_strcmp0 (a->color_string, b->color_string) == 0 &&
+    a->start_time == b->start_time                    &&
+    a->end_time   == b->end_time                      &&
     a->is_all_day == b->is_all_day;
 }
 
@@ -959,14 +952,14 @@ calendar_task_equal (CalendarTask *a,
 		     CalendarTask *b)
 {
   return
-    null_safe_strcmp (a->uid,          b->uid)          == 0 &&
-    null_safe_strcmp (a->summary,      b->summary)      == 0 &&
-    null_safe_strcmp (a->description,  b->description)  == 0 &&
-    null_safe_strcmp (a->color_string, b->color_string) == 0 &&
-    a->start_time       == b->start_time                   &&
-    a->due_time         == b->due_time                     &&
-    a->percent_complete == b->percent_complete             &&
-    a->completed_time   == b->completed_time               &&
+    g_strcmp0 (a->uid,          b->uid)          == 0 &&
+    g_strcmp0 (a->summary,      b->summary)      == 0 &&
+    g_strcmp0 (a->description,  b->description)  == 0 &&
+    g_strcmp0 (a->color_string, b->color_string) == 0 &&
+    a->start_time       == b->start_time              &&
+    a->due_time         == b->due_time                &&
+    a->percent_complete == b->percent_complete        &&
+    a->completed_time   == b->completed_time          &&
     a->priority         == b->priority;
 }
 



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