Durrp!
This commit is contained in:
parent
e96f8edd98
commit
680e42c8ef
2 changed files with 6 additions and 6 deletions
|
@ -23,10 +23,10 @@ static void _destroy(skipstone_map *map, void (*destructor)(void *), int depth)
|
||||||
|
|
||||||
for (i=0; i<SKIPSTONE_MAP_SLOTS; i++) {
|
for (i=0; i<SKIPSTONE_MAP_SLOTS; i++) {
|
||||||
if (map[i].next) {
|
if (map[i].next) {
|
||||||
if (destructor && depth == SKIPSTONE_MAP_DEPTH) {
|
if (depth < SKIPSTONE_MAP_DEPTH) {
|
||||||
destructor(map[i].value);
|
|
||||||
} else {
|
|
||||||
_destroy(map[i].next, destructor, depth + 1);
|
_destroy(map[i].next, destructor, depth + 1);
|
||||||
|
} else if (destructor) {
|
||||||
|
destructor(map[i].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@ static void _destroy(skipstone_map *map, void (*destructor)(void *), int depth)
|
||||||
|
|
||||||
for (i=0; i<SKIPSTONE_MAP_SLOTS; i++) {
|
for (i=0; i<SKIPSTONE_MAP_SLOTS; i++) {
|
||||||
if (map[i].next) {
|
if (map[i].next) {
|
||||||
if (destructor && depth == SKIPSTONE_MAP_DEPTH) {
|
if (depth < SKIPSTONE_MAP_DEPTH) {
|
||||||
destructor(map[i].value);
|
|
||||||
} else {
|
|
||||||
_destroy(map[i].next, destructor, depth + 1);
|
_destroy(map[i].next, destructor, depth + 1);
|
||||||
|
} else if (destructor) {
|
||||||
|
destructor(map[i].value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue