platform: g_hash_table_add doesn't return a value before 2.40

(cherry picked from commit 14bfd55361)
This commit is contained in:
Lubomir Rintel 2015-06-22 17:01:37 +02:00
parent 55e4ab8dd6
commit 2d4bd3818f

View file

@ -1319,8 +1319,12 @@ _nmp_cache_update_add (NMPCache *cache, NMPObject *obj)
nm_assert (!obj->is_cached);
nmp_object_ref (obj);
nm_assert (!nm_multi_index_lookup_first_by_value (cache->idx_multi, &obj->object));
#if GLIB_CHECK_VERSION(2, 40, 0)
if (!g_hash_table_add (cache->idx_main, obj))
g_assert_not_reached ();
#else
g_hash_table_add (cache->idx_main, obj);
#endif
obj->is_cached = TRUE;
_nmp_cache_update_cache (cache, obj, FALSE);
}