contacts-provider: Simplify refcounting in lookup_id()
g_autoptr usage was a bit pointless here since calls_contacts_provider_lookup_id() is transfer full
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user