/**************************************************************************
*
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2008 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/**
* Key lookup/associative container.
*
- * Like Jose's u_hash_table, based on CSO cache code for now.
+ * Like Jose's util_hash_table, based on CSO cache code for now.
*
* Author: Brian Paul
*/
#include "pipe/p_compiler.h"
-#include "pipe/p_debug.h"
-#include "pipe/p_error.h"
+#include "util/u_debug.h"
#include "cso_cache/cso_hash.h"
}
-static INLINE struct keymap_item *
+static inline struct keymap_item *
hash_table_item(struct cso_hash_iter iter)
{
return (struct keymap_item *) cso_hash_iter_data(iter);
}
-static INLINE struct cso_hash_iter
+static inline struct cso_hash_iter
hash_table_find_iter(const struct keymap *map, const void *key,
unsigned key_hash)
{
}
-static INLINE struct keymap_item *
+static inline struct keymap_item *
hash_table_find_item(const struct keymap *map, const void *key,
unsigned key_hash)
{
struct cso_hash_iter iter;
assert(map);
+ if (!map)
+ return FALSE;
key_hash = hash(key, map->key_size);
struct keymap_item *item;
assert(map);
+ if (!map)
+ return NULL;
key_hash = hash(key, map->key_size);
struct keymap_item *item;
assert(map);
+ if (!map)
+ return;
key_hash = hash(key, map->key_size);
item = hash_table_item(iter);
assert(item);
+ if (!item)
+ return;
map->delete_func(map, item->key, item->value, user);
FREE(item->key);
FREE(item);
struct keymap_item *item;
assert(map);
-
+ if (!map)
+ return;
+
iter = cso_hash_first_node(map->cso);
while (!cso_hash_iter_is_null(iter)) {
item = (struct keymap_item *)