[gnome-calendar] event: Trivial cleanup
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-calendar] event: Trivial cleanup
 
- Date: Thu, 18 Jun 2020 00:25:14 +0000 (UTC)
 
commit 158c65db4bc9e817a68e9778e33743bd276f6688
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jun 17 21:01:28 2020 -0300
    event: Trivial cleanup
    
    We can avoid a lookup by simply checking if the alarm id
    isn't NULL.
 src/core/gcal-event.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/core/gcal-event.c b/src/core/gcal-event.c
index fdbd36c9..e44fa687 100644
--- a/src/core/gcal-event.c
+++ b/src/core/gcal-event.c
@@ -1266,15 +1266,15 @@ void
 gcal_event_remove_alarm (GcalEvent *self,
                          guint      type)
 {
+  const gchar *alarm_uid;
+
   g_return_if_fail (GCAL_IS_EVENT (self));
 
+  alarm_uid = g_hash_table_lookup (self->alarms, GINT_TO_POINTER (type));
+
   /* Only 1 alarm per relative time */
-  if (g_hash_table_contains (self->alarms, GINT_TO_POINTER (type)))
+  if (alarm_uid)
     {
-      const gchar *alarm_uid;
-
-      alarm_uid = g_hash_table_lookup (self->alarms, GINT_TO_POINTER (type));
-
       e_cal_component_remove_alarm (self->component, alarm_uid);
 
       g_hash_table_remove (self->alarms, GINT_TO_POINTER (type));
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]