Nuked some code obsoleted by reference counting.

This commit is contained in:
Brian Koropoff 2003-01-31 21:47:16 +00:00
parent 05fb5f9fb2
commit 5870c2cbce
3 changed files with 4 additions and 21 deletions

View file

@ -46,7 +46,7 @@
typedef struct gib_tree_s { typedef struct gib_tree_s {
const char *str; const char *str;
char delim; char delim;
struct gib_tree_s *children, *next, *parent, *jump; struct gib_tree_s *children, *next, *jump;
unsigned int flags, start, end, refs; unsigned int flags, start, end, refs;
} gib_tree_t; } gib_tree_t;

View file

@ -262,7 +262,6 @@ GIB_Parse_Tokens (const char *program, unsigned int *i, unsigned int flags, gib_
// Try to parse sub-program // Try to parse sub-program
if (!(new = GIB_Parse_Lines (str, flags))) if (!(new = GIB_Parse_Lines (str, flags)))
goto ERROR; goto ERROR;
new->parent = cur;
cur->children = new; cur->children = new;
// Check for embedded commands/variables // Check for embedded commands/variables
} else if (cur->delim == ' ' || cur->delim == '(') { } else if (cur->delim == ' ' || cur->delim == '(') {
@ -272,7 +271,6 @@ GIB_Parse_Tokens (const char *program, unsigned int *i, unsigned int flags, gib_
goto ERROR; goto ERROR;
} else { } else {
// Link/set flags // Link/set flags
cur->children->parent = cur;
cur->flags |= TREE_P_EMBED; cur->flags |= TREE_P_EMBED;
// Add any embedded commands to top of chain // Add any embedded commands to top of chain
if (new) { if (new) {
@ -332,7 +330,6 @@ GIB_Parse_Semantic_Preprocess (gib_tree_t *line)
p = line; p = line;
// Move subprogram inline // Move subprogram inline
line->next = line->children->next->next->children; line->next = line->children->next->next->children;
line->next->parent = 0;
line->children->next->next->children = 0; line->children->next->next->children = 0;
// Find end of subprogram // Find end of subprogram
while (line->next) line = line->next; while (line->next) line = line->next;
@ -352,7 +349,6 @@ GIB_Parse_Semantic_Preprocess (gib_tree_t *line)
if (p->children->next->next->next->next->delim == '{') { if (p->children->next->next->next->next->delim == '{') {
// Move subprogram inline // Move subprogram inline
line->next = p->children->next->next->next->next->children; line->next = p->children->next->next->next->next->children;
line->next->parent = 0;
p->children->next->next->next->next->children = 0; p->children->next->next->next->next->children = 0;
while (line->next) line = line->next; while (line->next) line = line->next;
} else { } else {
@ -390,7 +386,6 @@ GIB_Parse_Semantic_Preprocess (gib_tree_t *line)
p = line; p = line;
// Move subprogram inline // Move subprogram inline
line->next = line->children->next->next->children; line->next = line->children->next->next->children;
line->next->parent = 0;
line->children->next->next->children = 0; line->children->next->next->children = 0;
// Find end of subprogram, set jump point back to top of loop as we go // Find end of subprogram, set jump point back to top of loop as we go
for (; line->next; line = line->next) for (; line->next; line = line->next)
@ -418,8 +413,6 @@ GIB_Parse_Semantic_Preprocess (gib_tree_t *line)
p = line; p = line;
// Move subprogram inline // Move subprogram inline
line->next = tmp->children; line->next = tmp->children;
line->next->parent = 0;
tmp->children = 0;
// Find end of subprogram, set jump point back to top of loop as we go // Find end of subprogram, set jump point back to top of loop as we go
for (; line->next; line = line->next) for (; line->next; line = line->next)
if (!line->jump) if (!line->jump)
@ -455,7 +448,6 @@ GIB_Parse_Lines (const char *program, unsigned int flags)
memcpy (str, program+lstart, i - lstart); memcpy (str, program+lstart, i - lstart);
cur->str = str; cur->str = str;
cur->children = tokens; cur->children = tokens;
tokens->parent = cur;
// Line contains embedded commands? // Line contains embedded commands?
if (embs) { if (embs) {
// Add them to chain before actual line // Add them to chain before actual line
@ -515,7 +507,6 @@ GIB_Parse_Embedded (const char *program, unsigned int flags, gib_tree_t **embedd
goto ERROR; goto ERROR;
} }
cur->children = tokens; cur->children = tokens;
tokens->parent = cur;
GIB_Parse_Semantic_Preprocess (cur)->next = *embedded; GIB_Parse_Semantic_Preprocess (cur)->next = *embedded;
if (gib_parse_error) if (gib_parse_error)
goto ERROR; goto ERROR;

View file

@ -51,16 +51,6 @@ GIB_Tree_New (unsigned int flags)
return new; return new;
} }
static void
GIB_Tree_Free (gib_tree_t *tree)
{
if (tree->str)
free((void *) tree->str);
if (tree->parent)
tree->parent->children = 0;
free(tree);
}
void void
GIB_Tree_Free_Recursive (gib_tree_t *tree) GIB_Tree_Free_Recursive (gib_tree_t *tree)
{ {
@ -75,6 +65,8 @@ GIB_Tree_Free_Recursive (gib_tree_t *tree)
tree->children->refs--; tree->children->refs--;
GIB_Tree_Free_Recursive (tree->children); GIB_Tree_Free_Recursive (tree->children);
} }
GIB_Tree_Free (tree); if (tree->str)
free((void *) tree->str);
free(tree);
} }
} }