| 106 | } |
| 107 | |
| 108 | static int cb_descend(struct cb_node *p, cb_iter fn, void *arg) |
| 109 | { |
| 110 | if (1 & (uintptr_t)p) { |
| 111 | struct cb_node *q = cb_node_of(p); |
| 112 | int ret = cb_descend(q->child[0], fn, arg); |
| 113 | if (ret) |
| 114 | return ret; |
| 115 | return cb_descend(q->child[1], fn, arg); |
| 116 | } else { |
| 117 | return fn(p, arg); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | int cb_each(struct cb_tree *t, const uint8_t *kpfx, size_t klen, |
| 122 | cb_iter fn, void *arg) |