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

Function AttributeSet_ShallowClone

src/graph/entities/attribute_set.c:373–395  ·  view source on GitHub ↗

clones attribute-set without SI values

Source from the content-addressed store, hash-verified

371
372// clones attribute-set without SI values
373AttributeSet AttributeSet_ShallowClone
374(
375 const AttributeSet set // set to clone
376) {
377 // in case attribute-set is marked as read-only, clear marker
378 AttributeSet _set = (AttributeSet)ATTRIBUTE_SET_CLEAR_MSB(set);
379
380 if(_set == NULL) return NULL;
381
382 size_t n = ATTRIBUTESET_BYTE_SIZE(set);
383 AttributeSet clone = rm_malloc(n);
384 clone->attr_count = _set->attr_count;
385
386 for(uint16_t i = 0; i < _set->attr_count; ++i) {
387 Attribute *attr = _set->attributes + i;
388 Attribute *clone_attr = clone->attributes + i;
389
390 clone_attr->id = attr->id;
391 clone_attr->value = SI_ShareValue(attr->value);
392 }
393
394 return clone;
395}
396
397// persists all attributes within given set
398void AttributeSet_PersistValues

Callers 1

EvalEntityUpdatesFunction · 0.85

Calls 2

rm_mallocFunction · 0.85
SI_ShareValueFunction · 0.85

Tested by

no test coverage detected