61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <string/free.h>
|
|
|
|
#include "struct.h"
|
|
#include "free.h"
|
|
|
|
void free_stringtree(
|
|
struct stringtree* this)
|
|
{
|
|
ENTER;
|
|
|
|
if (this && !--this->refcount)
|
|
{
|
|
struct child* c = this->head;
|
|
|
|
struct child* n = c->next;
|
|
|
|
for (; c; c = n)
|
|
{
|
|
n = c->next;
|
|
|
|
switch (c->kind)
|
|
{
|
|
case ck_cstr:
|
|
{
|
|
break;
|
|
}
|
|
|
|
case ck_string:
|
|
{
|
|
free_string(c->string);
|
|
|
|
break;
|
|
}
|
|
|
|
case ck_stringtree:
|
|
{
|
|
free_stringtree(c->stringtree);
|
|
|
|
break;
|
|
}
|
|
|
|
default:
|
|
TODO;
|
|
break;
|
|
}
|
|
|
|
free(c);
|
|
}
|
|
|
|
free(this);
|
|
}
|
|
|
|
EXIT;
|
|
}
|
|
|