mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-11-16 05:15:36 +00:00
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:
parent
343eb5919e
commit
0da19790c5
1 changed files with 5 additions and 8 deletions
|
@ -417,7 +417,7 @@ CallsBestMatch *
|
||||||
calls_contacts_provider_lookup_id (CallsContactsProvider *self,
|
calls_contacts_provider_lookup_id (CallsContactsProvider *self,
|
||||||
const char *id)
|
const char *id)
|
||||||
{
|
{
|
||||||
g_autoptr (CallsBestMatch) best_match = NULL;
|
CallsBestMatch *best_match;
|
||||||
|
|
||||||
g_return_val_if_fail (CALLS_IS_CONTACTS_PROVIDER (self), NULL);
|
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);
|
best_match = g_hash_table_lookup (self->best_matches, id);
|
||||||
|
|
||||||
if (best_match) {
|
if (best_match)
|
||||||
g_object_ref (best_match);
|
return g_object_ref (best_match);
|
||||||
|
|
||||||
return g_steal_pointer (&best_match);
|
|
||||||
}
|
|
||||||
|
|
||||||
best_match = calls_best_match_new (id);
|
best_match = calls_best_match_new (id);
|
||||||
|
|
||||||
|
@ -438,9 +435,9 @@ calls_contacts_provider_lookup_id (CallsContactsProvider *self,
|
||||||
best_match, "country-code",
|
best_match, "country-code",
|
||||||
G_BINDING_SYNC_CREATE);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue