diff --git a/qpkg/jrb.c b/qpkg/jrb.c index 306b113..71e84ae 100644 --- a/qpkg/jrb.c +++ b/qpkg/jrb.c @@ -94,13 +94,19 @@ static void delete_item(JRB item) /* Deletes an arbitrary iterm */ item->blink->flink = item->flink; } -#define mk_new_ext(new, kkkey, vvval) { \ - new = (JRB) malloc(sizeof(struct jrb_node)); \ - new->val = vvval; \ - new->key = kkkey; \ - setext(new); \ - setblack(new); \ - setnormal(new); \ + +static JRB mk_new_ext(void *key, void *val) +{ + JRB new; + + new = (JRB) malloc(sizeof(struct jrb_node)); + new->val = val; + new->key = key; + setext(new); + setblack(new); + setnormal(new); + + return new; } static void mk_new_int(JRB l, JRB r, JRB p, int il) @@ -230,14 +236,14 @@ static JRB jrb_insert_b(JRB n, void *key, void *val) if (ishead(n)) { if (n->parent == n) { /* Tree is empty */ - mk_new_ext(newnode, key, val); + newnode = mk_new_ext(key, val); insert(newnode, n); n->parent = newnode; newnode->parent = n; setroot(newnode); return newnode; } else { - mk_new_ext(newright, key, val); + newright = mk_new_ext(key, val); insert(newright, n); newleft = newright->blink; setnormal(newleft); @@ -249,7 +255,7 @@ static JRB jrb_insert_b(JRB n, void *key, void *val) return newright; } } else { - mk_new_ext(newleft, key, val); + newleft = mk_new_ext(key, val); insert(newleft, n); setnormal(n); mk_new_int(newleft, n, n->parent, isleft(n));