MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _get_vars_inner_rep

Function _get_vars_inner_rep

src/ast/ast_rewrite_call_subquery.c:14–40  ·  view source on GitHub ↗

fill `names` and `inner_names` with the bound vars and their internal representation, respectively

Source from the content-addressed store, hash-verified

12// fill `names` and `inner_names` with the bound vars and their internal
13// representation, respectively
14static 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
43static uint _add_names_projections

Callers 1

_rewrite_projectionsFunction · 0.85

Calls 2

rm_strndupFunction · 0.85
rm_mallocFunction · 0.85

Tested by

no test coverage detected