event: Trivial cleanup
We can avoid a lookup by simply checking if the alarm id isn't NULL.
This commit is contained in:
@@ -1266,15 +1266,15 @@ void
|
|||||||
gcal_event_remove_alarm (GcalEvent *self,
|
gcal_event_remove_alarm (GcalEvent *self,
|
||||||
guint type)
|
guint type)
|
||||||
{
|
{
|
||||||
|
const gchar *alarm_uid;
|
||||||
|
|
||||||
g_return_if_fail (GCAL_IS_EVENT (self));
|
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 */
|
/* 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);
|
e_cal_component_remove_alarm (self->component, alarm_uid);
|
||||||
|
|
||||||
g_hash_table_remove (self->alarms, GINT_TO_POINTER (type));
|
g_hash_table_remove (self->alarms, GINT_TO_POINTER (type));
|
||||||
|
|||||||
Reference in New Issue
Block a user