diff --git a/gfx/cairo/cairo/src/cairo-hash.c b/gfx/cairo/cairo/src/cairo-hash.c --- a/gfx/cairo/cairo/src/cairo-hash.c +++ b/gfx/cairo/cairo/src/cairo-hash.c @@ -443,18 +466,18 @@ _cairo_hash_table_random_entry (cairo_ha /** * _cairo_hash_table_insert: * @hash_table: a hash table * @key_and_value: an entry to be inserted * * Insert the entry #key_and_value into the hash table. * - * WARNING: It is a fatal error if an entry exists in the hash table - * with a matching key, (this function will halt). + * WARNING: There must not be an existing entry in the hash table + * with a matching key. * * WARNING: It is a fatal error to insert an element while * an iterator is running * * Instead of using insert to replace an entry, consider just editing * the entry obtained with _cairo_hash_table_lookup. Or if absolutely * necessary, use _cairo_hash_table_remove first. * @@ -467,23 +490,20 @@ _cairo_hash_table_insert (cairo_hash_tab { cairo_status_t status; cairo_hash_entry_t **entry; /* Insert is illegal while an iterator is running. */ assert (hash_table->iterating == 0); entry = _cairo_hash_table_lookup_internal (hash_table, - key_and_value, FALSE); + key_and_value, TRUE); - - if (ENTRY_IS_LIVE(*entry)) - { - /* User is being bad, let's crash. */ - ASSERT_NOT_REACHED; - } + /* _cairo_hash_table_lookup_internal with key_unique = TRUE + * aways returns an available entry. */ + assert (! ENTRY_IS_LIVE(*entry)); *entry = key_and_value; hash_table->live_entries++; status = _cairo_hash_table_resize (hash_table); if (status) { /* abort the insert... */ *entry = DEAD_ENTRY;