projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: Update for os_stream changes.
[mesa.git]
/
src
/
gallium
/
auxiliary
/
util
/
u_handle_table.c
diff --git
a/src/gallium/auxiliary/util/u_handle_table.c
b/src/gallium/auxiliary/util/u_handle_table.c
index 2d15932ce3bb847eb3a84156d86a127642967956..3703718a621d0a6ae1a90386c11a74c0bafbbe77 100644
(file)
--- a/
src/gallium/auxiliary/util/u_handle_table.c
+++ b/
src/gallium/auxiliary/util/u_handle_table.c
@@
-34,7
+34,7
@@
#include "pipe/p_compiler.h"
#include "pipe/p_compiler.h"
-#include "
pipe/p
_debug.h"
+#include "
util/u
_debug.h"
#include "util/u_memory.h"
#include "util/u_handle_table.h"
#include "util/u_memory.h"
#include "util/u_handle_table.h"
@@
-87,6
+87,8
@@
handle_table_set_destroy(struct handle_table *ht,
void (*destroy)(void *object))
{
assert(ht);
void (*destroy)(void *object))
{
assert(ht);
+ if (!ht)
+ return;
ht->destroy = destroy;
}
ht->destroy = destroy;
}
@@
-155,7
+157,7
@@
handle_table_add(struct handle_table *ht,
assert(ht);
assert(object);
assert(ht);
assert(object);
- if(!object)
+ if(!object
|| !ht
)
return 0;
/* linear search for an empty handle */
return 0;
/* linear search for an empty handle */
@@
-193,7
+195,7
@@
handle_table_set(struct handle_table *ht,
assert(ht);
assert(handle);
assert(ht);
assert(handle);
- if(!handle)
+ if(!handle
|| !ht
)
return 0;
assert(object);
return 0;
assert(object);
@@
-222,7
+224,7
@@
handle_table_get(struct handle_table *ht,
assert(ht);
assert(handle);
assert(ht);
assert(handle);
- if(!handle || handle > ht->size)
+ if(!handle ||
!ht ||
handle > ht->size)
return NULL;
object = ht->objects[handle - 1];
return NULL;
object = ht->objects[handle - 1];
@@
-240,7
+242,7
@@
handle_table_remove(struct handle_table *ht,
assert(ht);
assert(handle);
assert(ht);
assert(handle);
- if(!handle || handle > ht->size)
+ if(!handle ||
!ht ||
handle > ht->size)
return;
index = handle - 1;
return;
index = handle - 1;
@@
-283,6
+285,9
@@
handle_table_destroy(struct handle_table *ht)
unsigned index;
assert(ht);
unsigned index;
assert(ht);
+ if (!ht)
+ return;
+
if(ht->destroy)
for(index = 0; index < ht->size; ++index)
handle_table_clear(ht, index);
if(ht->destroy)
for(index = 0; index < ht->size; ++index)
handle_table_clear(ht, index);