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

Function UpdateCtx_Clone

src/ast/ast_shared.c:177–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177EntityUpdateEvalCtx *UpdateCtx_Clone
178(
179 const EntityUpdateEvalCtx *orig
180) {
181 EntityUpdateEvalCtx *clone = rm_malloc(sizeof(EntityUpdateEvalCtx));
182
183 uint count = array_len(orig->properties);
184
185 clone->alias = orig->alias;
186 clone->record_idx = orig->record_idx;
187 clone->properties = array_new(PropertySetCtx, count);
188 clone->add_labels = NULL;
189 clone->remove_labels = NULL;
190 if(orig->add_labels != NULL) {
191 array_clone(clone->add_labels, orig->add_labels);
192 }
193 if(orig->remove_labels != NULL) {
194 array_clone(clone->remove_labels, orig->remove_labels);
195 }
196
197 for(uint i = 0; i < count; i ++) {
198 PropertySetCtx update = {
199 .attribute = orig->properties[i].attribute,
200 .exp = AR_EXP_Clone(orig->properties[i].exp),
201 .mode = orig->properties[i].mode,
202 };
203 array_append(clone->properties, update);
204 }
205
206 return clone;
207}
208
209void UpdateCtx_Clear
210(

Callers

nothing calls this directly

Calls 3

rm_mallocFunction · 0.85
array_lenFunction · 0.85
AR_EXP_CloneFunction · 0.85

Tested by

no test coverage detected