third_party/cairo/src/cairo-hash.c
cairo_status_t
_cairo_hash_table_insert (cairo_hash_table_t *hash_table,
			  cairo_hash_entry_t *key_and_value)
{
    cairo_hash_entry_t **entry;
    cairo_status_t status;

    /* Insert is illegal while an iterator is running. */
    assert (hash_table->iterating == 0);

    status = _cairo_hash_table_manage (hash_table);
    if (unlikely (status))
	return status;

    entry = _cairo_hash_table_lookup_unique_key (hash_table, key_and_value);

    if (ENTRY_IS_FREE (*entry))
	hash_table->free_entries--;

    *entry = key_and_value;
    hash_table->cache[key_and_value->hash & 31] = key_and_value;
    hash_table->live_entries++;

    return CAIRO_STATUS_SUCCESS;
}
/**
 * _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: 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.
 *
 * Return value: %CAIRO_STATUS_SUCCESS if successful or
 * %CAIRO_STATUS_NO_MEMORY if insufficient memory is available.
 **/
@hash_table: a hash table
@key_and_value: an entry to be inserted

Insert the entry #key_and_value into the hash table.

There must not be an existing entry in the hash table
with a matching key.

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.

Return value: %CAIRO_STATUS_SUCCESS if successful or
%CAIRO_STATUS_NO_MEMORY if insufficient memory is available.
@hash_table : a hash table @key_and_value : an entry to be inserted Insert the entry #key_and_value into the hash table . There must not be an existing entry in the hash table with a matching key . 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 . Return value : %CAIRO_STATUS_SUCCESS if successful or %CAIRO_STATUS_NO_MEMORY if insufficient memory is available .
cairo_status_t
_cairo_hash_table_insert (cairo_hash_table_t *hash_table,
			  cairo_hash_entry_t *key_and_value)
{
    cairo_hash_entry_t **entry;
    cairo_status_t status;
    assert (hash_table->iterating == 0);
    status = _cairo_hash_table_manage (hash_table);
    if (unlikely (status))
	return status;
    entry = _cairo_hash_table_lookup_unique_key (hash_table, key_and_value);
    if (ENTRY_IS_FREE (*entry))
	hash_table->free_entries--;
    *entry = key_and_value;
    hash_table->cache[key_and_value->hash & 31] = key_and_value;
    hash_table->live_entries++;
    return CAIRO_STATUS_SUCCESS;
}
cairo_status_t _cairo_hash_table_insert ( cairo_hash_table_t * hash_table , cairo_hash_entry_t * key_and_value ) { cairo_hash_entry_t * * entry ; cairo_status_t status ; assert ( hash_table -> iterating == 0 ) ; status = _cairo_hash_table_manage ( hash_table ) ; if ( unlikely ( status ) ) return status ; entry = _cairo_hash_table_lookup_unique_key ( hash_table , key_and_value ) ; if ( ENTRY_IS_FREE ( * entry ) ) hash_table -> free_entries -- ; * entry = key_and_value ; hash_table -> cache [ key_and_value -> hash & 31 ] = key_and_value ; hash_table -> live_entries ++ ; return CAIRO_STATUS_SUCCESS ; }
_cairo_hash_table_insert:
 @hash_table: a hash table
 @key_and_value: an entry to be inserted
_cairo_hash_table_insert : @hash_table : a hash table @key_and_value : an entry to be inserted
/* Insert is illegal while an iterator is running. */