fill `names` and `inner_names` with the bound vars and their internal representation, respectively
| 12 | // fill `names` and `inner_names` with the bound vars and their internal |
| 13 | // representation, respectively |
| 14 | static void _get_vars_inner_rep |
| 15 | ( |
| 16 | rax *outer_mapping, // rax containing bound vars |
| 17 | char ***names, // [OUTPUT] bound vars |
| 18 | char ***inter_names // [OUTPUT] internal representation of vars |
| 19 | ) { |
| 20 | ASSERT(outer_mapping != NULL); |
| 21 | |
| 22 | raxIterator it; |
| 23 | raxStart(&it, outer_mapping); |
| 24 | raxSeek(&it, "^", NULL, 0); |
| 25 | while(raxNext(&it)) { |
| 26 | // avoid multiple internal representations of the same alias |
| 27 | if(it.key[0] == '@') { |
| 28 | continue; |
| 29 | } |
| 30 | |
| 31 | char *curr = rm_strndup((const char *)it.key, it.key_len); |
| 32 | char *internal_rep = rm_malloc(it.key_len + 2); |
| 33 | sprintf(internal_rep, "@%.*s", (int)it.key_len, it.key); |
| 34 | |
| 35 | // append original name |
| 36 | array_append(*names, curr); |
| 37 | // append internal (temporary) name |
| 38 | array_append(*inter_names, internal_rep); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // adds projections from `names` to `inter_names` into `projections` array |
| 43 | static uint _add_names_projections |
no test coverage detected