projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
refactor thrd_sleep and nanosleep in terms of clock_nanosleep
[oweals/musl.git]
/
src
/
search
/
tdestroy.c
1
#define _GNU_SOURCE
2
#include <stdlib.h>
3
#include <search.h>
4
#include "tsearch.h"
5
6
void tdestroy(void *root, void (*freekey)(void *))
7
{
8
struct node *r = root;
9
10
if (r == 0)
11
return;
12
tdestroy(r->a[0], freekey);
13
tdestroy(r->a[1], freekey);
14
if (freekey) freekey((void *)r->key);
15
free(r);
16
}