summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_handle_table.c
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-03-22 10:05:55 +0000
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-03-22 10:59:52 +0000
commit4e977fb35befa60b2f74a21c0c9818854e6a7c85 (patch)
tree59a9038a560f98e4dca6c5a3b2dcf14fec749eff /src/gallium/auxiliary/util/u_handle_table.c
parent47531442e9c89c3ca764e9be225cfaec388609a1 (diff)
gallium: Remove pedantic asserts.
Move these to a higher level instead.
Diffstat (limited to 'src/gallium/auxiliary/util/u_handle_table.c')
-rw-r--r--src/gallium/auxiliary/util/u_handle_table.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/gallium/auxiliary/util/u_handle_table.c b/src/gallium/auxiliary/util/u_handle_table.c
index 5a731a6b96..2176a00959 100644
--- a/src/gallium/auxiliary/util/u_handle_table.c
+++ b/src/gallium/auxiliary/util/u_handle_table.c
@@ -170,7 +170,7 @@ handle_table_set(struct handle_table *ht,
unsigned index;
assert(ht);
- assert(handle > 0);
+ assert(handle);
if(!handle)
return 0;
@@ -184,7 +184,9 @@ handle_table_set(struct handle_table *ht,
if(!handle_table_resize(ht, index))
return 0;
- assert(!ht->objects[index]);
+ if(ht->objects[index] && ht->destroy)
+ ht->destroy(ht->objects[index]);
+
ht->objects[index] = object;
return handle;
@@ -198,13 +200,11 @@ handle_table_get(struct handle_table *ht,
void *object;
assert(ht);
- assert(handle > 0);
- assert(handle <= ht->size);
+ assert(handle);
if(!handle || handle > ht->size)
return NULL;
object = ht->objects[handle - 1];
- assert(object);
return object;
}
@@ -218,18 +218,14 @@ handle_table_remove(struct handle_table *ht,
unsigned index;
assert(ht);
- assert(handle > 0);
- assert(handle <= ht->size);
+ assert(handle);
if(!handle || handle > ht->size)
return;
index = handle - 1;
object = ht->objects[index];
- if(!object) {
- /* XXX: this warning may be noisy for legitimate use -- remove later */
- debug_warning("removing empty handle");
+ if(!object)
return;
- }
if(ht->destroy)
ht->destroy(object);