From 158c65db4bc9e817a68e9778e33743bd276f6688 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 17 Jun 2020 21:01:28 -0300 Subject: [PATCH] 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));