| 39 | } |
| 40 | |
| 41 | rax *raxCloneWithCallback(rax *orig, void *(*clone_callback)(void *)) { |
| 42 | rax *clone = raxNew(); |
| 43 | |
| 44 | raxIterator it; |
| 45 | raxStart(&it, orig); |
| 46 | raxSeek(&it, "^", NULL, 0); |
| 47 | |
| 48 | // For each key in the original, duplicate the key and its value in the clone. |
| 49 | while(raxNext(&it)) { |
| 50 | void *data = clone_callback(it.data); |
| 51 | raxInsert(clone, it.key, it.key_len, data, NULL); |
| 52 | } |
| 53 | |
| 54 | raxStop(&it); |
| 55 | return clone; |
| 56 | } |
| 57 | |
| 58 | void **raxValues(rax *rax) { |
| 59 | // Instantiate an array to hold all of the values in the rax. |
no outgoing calls
no test coverage detected