From 39f19113d30e87c1604ed4e8e39ea95f87296767 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 28 Nov 2014 08:54:40 +0100 Subject: m + macro call alternation elimination MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/tree.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/mds-kbdc/tree.c') diff --git a/src/mds-kbdc/tree.c b/src/mds-kbdc/tree.c index b11bb6c..5d00601 100644 --- a/src/mds-kbdc/tree.c +++ b/src/mds-kbdc/tree.c @@ -229,8 +229,8 @@ void mds_kbdc_tree_free(mds_kbdc_tree_t* restrict this) * * @param member:identifer The member in the tree to duplicate */ -#define T(member) \ - if (n->member = mds_kbdc_tree_dup(t->member), n->member == NULL) goto fail +#define T(member) \ + if (t->member && (n->member = mds_kbdc_tree_dup(t->member), n->member == NULL)) goto fail /** @@ -238,8 +238,8 @@ void mds_kbdc_tree_free(mds_kbdc_tree_t* restrict this) * * @param member:identifer The member in the tree to duplicate */ -#define S(member) \ - if (n->member = strdup(t->member), n->member == NULL) goto fail +#define S(member) \ + if (t->member && (n->member = strdup(t->member), n->member == NULL)) goto fail /** @@ -273,8 +273,12 @@ mds_kbdc_tree_t* mds_kbdc_tree_dup(mds_kbdc_tree_t* restrict this) node->loc_line = this->loc_line; node->loc_start = this->loc_start; node->loc_end = this->loc_end; - node->next = mds_kbdc_tree_dup(this->next); - if (node->next == NULL) goto fail; + node->processed = this->processed; + if (this->next) + { + node->next = mds_kbdc_tree_dup(this->next); + if (node->next == NULL) goto fail; + } switch (this->type) { -- cgit v1.2.3-70-g09d2