From 10d74634bafe5b7b8978635a1e5ba26c294f4614 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Mon, 10 Apr 2023 10:51:54 +0200 Subject: [PATCH] contacts-provider: Simplify refcounting in lookup_id() g_autoptr usage was a bit pointless here since calls_contacts_provider_lookup_id() is transfer full --- src/calls-contacts-provider.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/calls-contacts-provider.c b/src/calls-contacts-provider.c index 5ae014a..5652359 100644 --- a/src/calls-contacts-provider.c +++ b/src/calls-contacts-provider.c @@ -417,7 +417,7 @@ CallsBestMatch * calls_contacts_provider_lookup_id (CallsContactsProvider *self, const char *id) { - g_autoptr (CallsBestMatch) best_match = NULL; + CallsBestMatch *best_match; g_return_val_if_fail (CALLS_IS_CONTACTS_PROVIDER (self), NULL); @@ -426,11 +426,8 @@ calls_contacts_provider_lookup_id (CallsContactsProvider *self, best_match = g_hash_table_lookup (self->best_matches, id); - if (best_match) { - g_object_ref (best_match); - - return g_steal_pointer (&best_match); - } + if (best_match) + return g_object_ref (best_match); best_match = calls_best_match_new (id); @@ -438,9 +435,9 @@ calls_contacts_provider_lookup_id (CallsContactsProvider *self, best_match, "country-code", G_BINDING_SYNC_CREATE); - g_hash_table_insert (self->best_matches, g_strdup (id), g_object_ref (best_match)); + g_hash_table_insert (self->best_matches, g_strdup (id), best_match); - return g_steal_pointer (&best_match); + return g_object_ref (best_match); } /**