h
This commit is contained in:
Alessandro Mauri 2023-02-12 20:38:06 +01:00
parent 5018ccbbb0
commit 7552d2fa2a
No known key found for this signature in database
GPG key ID: 2B7BF9531FF03BE8
16 changed files with 3719 additions and 10 deletions

View file

@ -6,6 +6,7 @@
#include <string.h>
#include "hash.h"
#include "util.h"
#define MAXSIZE 4096
@ -27,7 +28,7 @@ struct hm_ref * hm_create(unsigned int size)
size = 1<<__builtin_clz(size);
// FIXME: check for intger overflow here
struct hm_ref *h = malloc(sizeof(struct hm_ref)+sizeof(struct hm_entry)*size);
struct hm_ref *h = emalloc(sizeof(struct hm_ref)+sizeof(struct hm_entry)*size);
if (h) {
h->items = 0;
h->size = size;
@ -39,7 +40,7 @@ struct hm_ref * hm_create(unsigned int size)
void hm_destroy(struct hm_ref *hm)
{
free(hm);
efree(hm);
}