49 lines
941 B
C
49 lines
941 B
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)
|
|
{
|
|
for (struct child* child = this->head, *next; child; child = next)
|
|
{
|
|
switch (child->kind)
|
|
{
|
|
case ck_cstr:
|
|
break;
|
|
|
|
case ck_string:
|
|
free_string(child->string);
|
|
break;
|
|
|
|
case ck_stringtree:
|
|
free_stringtree(child->stringtree);
|
|
break;
|
|
|
|
default:
|
|
TODO;
|
|
break;
|
|
}
|
|
|
|
next = child->next;
|
|
|
|
free(child);
|
|
}
|
|
|
|
free(this);
|
|
}
|
|
|
|
EXIT;
|
|
}
|
|
|