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

Function Record_Clone

src/execution_plan/record.c:82–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void Record_Clone
83(
84 const Record r,
85 Record clone
86) {
87 int entry_count = Record_length(r);
88 size_t required_record_size = sizeof(Entry) * entry_count;
89
90 memcpy(clone->entries, r->entries, required_record_size);
91
92 /* Foreach scalar entry in cloned record, make sure it is not freed.
93 * it is the original record owner responsibility to free the record
94 * and its internal scalar as a result.
95 *
96 * TODO: I wish we wouldn't have to perform this loop as it is a major performance hit
97 * with the introduction of a garbage collection this should be removed. */
98 for(int i = 0; i < entry_count; i++) {
99 if(Record_GetType(clone, i) == REC_TYPE_SCALAR) {
100 SIValue_MakeVolatile(&clone->entries[i].value.s);
101 }
102 }
103}
104
105void Record_DeepClone
106(

Callers 8

AR_ANYFunction · 0.85
AR_ALLFunction · 0.85
AR_SINGLEFunction · 0.85
AR_NONEFunction · 0.85
AR_LIST_COMPREHENSIONFunction · 0.85
AR_REDUCEFunction · 0.85
OpBase_CloneRecordFunction · 0.85
ForeachConsumeFunction · 0.85

Calls 3

Record_lengthFunction · 0.85
Record_GetTypeFunction · 0.85
SIValue_MakeVolatileFunction · 0.85

Tested by

no test coverage detected