Make sure we initialize object hash.

This patch also move the hash implementation details to wayland-util.c.
This commit is contained in:
Kristian Høgsberg 2008-12-12 11:05:17 -05:00 committed by Kristian Høgsberg
parent 997e71eb1e
commit 864c468b42
3 changed files with 42 additions and 11 deletions

View file

@ -21,8 +21,34 @@
*/
#include <stdlib.h>
#include <string.h>
#include "wayland.h"
struct wl_hash {
struct wl_object **objects;
uint32_t count, alloc;
};
struct wl_hash *
wl_hash_create(void)
{
struct wl_hash *hash;
hash = malloc(sizeof *hash);
if (hash == NULL)
return hash;
memset(hash, 0, sizeof *hash);
return hash;
}
void
wl_hash_destroy(struct wl_hash *hash)
{
free(hash);
}
int wl_hash_insert(struct wl_hash *hash, struct wl_object *object)
{
struct wl_object **objects;