Date:2010-11-20 00:23:16 (9 years 24 days ago)
Author:Werner Almesberger
Commit:5a422a470d264cbba8ab2d3b8270f1b8424b569c
Message:qpkg/jrb.c (mk_new_ext): converted from macro to function

Files: qpkg/jrb.c (3 diffs)

Change Details

qpkg/jrb.c
9494    item->blink->flink = item->flink;
9595}
9696
97#define mk_new_ext(new, kkkey, vvval) { \
98    new = (JRB) malloc(sizeof(struct jrb_node)); \
99    new->val = vvval; \
100    new->key = kkkey; \
101    setext(new); \
102    setblack(new); \
103    setnormal(new); \
97
98static JRB mk_new_ext(void *key, void *val)
99{
100    JRB new;
101
102    new = (JRB) malloc(sizeof(struct jrb_node));
103    new->val = val;
104    new->key = key;
105    setext(new);
106    setblack(new);
107    setnormal(new);
108
109    return new;
104110}
105111
106112static void mk_new_int(JRB l, JRB r, JRB p, int il)
...... 
230236
231237    if (ishead(n)) {
232238        if (n->parent == n) { /* Tree is empty */
233            mk_new_ext(newnode, key, val);
239            newnode = mk_new_ext(key, val);
234240            insert(newnode, n);
235241            n->parent = newnode;
236242            newnode->parent = n;
237243            setroot(newnode);
238244            return newnode;
239245        } else {
240            mk_new_ext(newright, key, val);
246            newright = mk_new_ext(key, val);
241247            insert(newright, n);
242248            newleft = newright->blink;
243249            setnormal(newleft);
...... 
249255            return newright;
250256        }
251257    } else {
252        mk_new_ext(newleft, key, val);
258        newleft = mk_new_ext(key, val);
253259        insert(newleft, n);
254260        setnormal(n);
255261        mk_new_int(newleft, n, n->parent, isleft(n));

Archive Download the corresponding diff file

Branches:
master



interactive