1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

Add asserts to address map / address set

This commit is contained in:
Andy Wingo 2025-01-06 15:49:59 +01:00
parent 95868c70a2
commit 4be3e69ac1
2 changed files with 6 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include <string.h>
#include "address-hash.h"
#include "gc-assert.h"
struct hash_map_entry {
uintptr_t k;
@ -28,7 +29,9 @@ static void hash_map_clear(struct hash_map *map) {
static void hash_map_init(struct hash_map *map, size_t size) {
map->size = size;
map->data = malloc(sizeof(struct hash_map_entry) * size);
if (!map->data) GC_CRASH();
map->bits = malloc(size / 8);
if (!map->bits) GC_CRASH();
hash_map_clear(map);
}
static void hash_map_destroy(struct hash_map *map) {

View file

@ -6,6 +6,7 @@
#include <string.h>
#include "address-hash.h"
#include "gc-assert.h"
struct hash_set {
uintptr_t *data;
@ -23,7 +24,9 @@ static void hash_set_clear(struct hash_set *set) {
static void hash_set_init(struct hash_set *set, size_t size) {
set->size = size;
set->data = malloc(sizeof(uintptr_t) * size);
if (!set->data) GC_CRASH();
set->bits = malloc(size / 8);
if (!set->bits) GC_CRASH();
hash_set_clear(set);
}
static void hash_set_destroy(struct hash_set *set) {