#include #include #include skipstone_map *skipstone_map_new() { skipstone_map *map; if ((map = malloc(SKIPSTONE_MAP_SLOTS * sizeof(*map))) == NULL) { goto error_malloc_map; } memset(map, 0, SKIPSTONE_MAP_SLOTS * sizeof(*map)); return map; error_malloc_map: return NULL; } static void _destroy(skipstone_map *map, int depth) { uint16_t i; if (depth > SKIPSTONE_MAP_DEPTH) { return; } for (i=0; i>= 4; } return map[index & 0x0f].value; } int skipstone_map_set(skipstone_map *map, uint16_t index, void *value) { uint16_t i; for (i=0; i>= 4; } map[index & 0x0f].value = value; return 0; error_new: return -1; }