Beispiel #1
0
void
PyNode_Free(node *n)
{
    if (n != NULL) {
        freechildren(n);
        PyObject_FREE(n);
    }
}
Beispiel #2
0
static void
freechildren(node *n)
{
    int i;
    for (i = NCH(n); --i >= 0; )
        freechildren(CHILD(n, i));
    if (n->n_child != NULL)
        PyObject_FREE(n->n_child);
    if (STR(n) != NULL)
        PyObject_FREE(STR(n));
}
Beispiel #3
0
static void
freechildren(node *n)
{
    int i;
    for (i = NCH(n); --i >= 0; )
        freechildren(CHILD(n, i));
    if (n->n_child != NULL)
        PyObject_FREE(n->n_child);
	/*
		Print statement modification :
		Free all nodes except those marked modified.
		Those are virtual nodes in the parse three that don't actually reside in the statement's memory,
		Freeing them is dangerous.
	*/
    if (STR(n) != NULL && (!n->n_wasModified))
        PyObject_FREE(STR(n));
}