+/* Licensed under LGPLv2.1+ - see LICENSE file for details */
#include <ccan/jmap/jmap.h>
#include <ccan/build_assert/build_assert.h>
#include <stdlib.h>
#include <string.h>
-struct jmap *jmap_new(void)
+struct jmap *jmap_new_(size_t size)
{
struct jmap *map;
/* We also put pointers into Judy, in jmap_types.h */
BUILD_ASSERT(sizeof(Word_t) >= sizeof(void *));
- map = malloc(sizeof(*map));
+ assert(size >= sizeof(*map));
+ map = malloc(size);
if (map) {
map->judy = NULL;
memset(&map->err, 0, sizeof(map->err));
return map;
}
-const char *jmap_error_(struct jmap *map)
+const char *jmap_error_str_(struct jmap *map)
{
char *str;
free((char *)map->errstr);
return str;
}
-void jmap_free(const struct jmap *map)
+void jmap_free_(const struct jmap *map)
{
free((char *)map->errstr);
- Judy1FreeArray((PPvoid_t)&map->judy, PJE0);
+ JudyLFreeArray((PPvoid_t)&map->judy, PJE0);
free((void *)map);
}