src/common/map.c
// Insert an entry into a map
Insert an entry into a map
Insert an entry into a map
enum natwm_error map_insert(struct map *map, const void *key, void *value)
{
        if (key == NULL) {
                return GENERIC_ERROR;
        }
        struct map_entry *entry = NULL;
        size_t key_size = map->key_size_function(key);
        uint32_t hash = map->hash_function(key, key_size);
        enum natwm_error error = entry_init(hash, key, value, &entry);
        if (error != NO_ERROR) {
                return error;
        }
        return map_insert_entry(map, entry);
}
enum natwm_error map_insert ( struct map * map , const void * key , void * value ) { if ( key == NULL ) { return GENERIC_ERROR ; } struct map_entry * entry = NULL ; size_t key_size = map -> key_size_function ( key ) ; uint32_t hash = map -> hash_function ( key , key_size ) ; enum natwm_error error = entry_init ( hash , key , value , & entry ) ; if ( error != NO_ERROR ) { return error ; } return map_insert_entry ( map , entry ) ; }
Insert an entry into a map
Insert an entry into a map