From 6c670b0a9851bd5ec3c7a90f20b164be2a54c5b2 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Wed, 8 Jan 2020 10:33:52 +0200 Subject: colm: removed flags field from the kid struct We eliminated the use of this field some time ago, but never removed the field from the struct. --- colm/print.c | 2 -- colm/tree.h | 14 +++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/colm/print.c b/colm/print.c index 317b197d..2b69e86a 100644 --- a/colm/print.c +++ b/colm/print.c @@ -430,11 +430,9 @@ void colm_print_tree_args( program_t *prg, tree_t **sp, kid_t kid, term; term.tree = &term_tree; term.next = 0; - term.flags = 0; kid.tree = tree; kid.next = &term; - kid.flags = 0; print_kid( prg, sp, print_args, &kid ); } diff --git a/colm/tree.h b/colm/tree.h index 460d22c6..97833c6f 100644 --- a/colm/tree.h +++ b/colm/tree.h @@ -67,19 +67,23 @@ typedef struct colm_data struct colm_location *location; } head_t; +/* Kid: used to implement a list of child trees. Kids are never shared. The + * trees they point to may be shared. This struct is also used on the stack by + * pushing two words and taking a pointer. We use it to take references to + * trees. Do not modify this struct. */ typedef struct colm_kid { - /* The tree needs to be first since pointers to kids are used to reference - * trees on the stack. A pointer to the word that is a tree_t* is cast to - * a kid_t*. */ struct colm_tree *tree; struct colm_kid *next; - unsigned char flags; } kid_t; +/* Reference chains. Allocated on the stack. The chain goes up the list of kids + * to the root of the reference and tells us which trees we need to split so + * they are not shared before we can modify a node in a tree. Do not change + * this struct. */ typedef struct colm_ref { - kid_t *kid; + struct colm_kid *kid; struct colm_ref *next; } ref_t; -- cgit v1.2.1