aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc/tree.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-11-28 08:54:40 +0100
committerMattias Andrée <maandree@operamail.com>2014-11-28 08:54:40 +0100
commit39f19113d30e87c1604ed4e8e39ea95f87296767 (patch)
tree8ee097832aae5f7346eb51a12b7aabd2066aac20 /src/mds-kbdc/tree.c
parentm (diff)
downloadmds-39f19113d30e87c1604ed4e8e39ea95f87296767.tar.gz
mds-39f19113d30e87c1604ed4e8e39ea95f87296767.tar.bz2
mds-39f19113d30e87c1604ed4e8e39ea95f87296767.tar.xz
m + macro call alternation elimination
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/tree.c16
1 files changed, 10 insertions, 6 deletions
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)
{