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

Function SortFree

src/execution_plan/ops/op_sort.c:215–254  ·  view source on GitHub ↗

frees sort

Source from the content-addressed store, hash-verified

213
214// frees sort
215static void SortFree(OpBase *ctx) {
216 OpSort *op = (OpSort *)ctx;
217
218 if(op->heap) {
219 uint recordCount = Heap_count(op->heap);
220 for(uint i = 0; i < recordCount; i++) {
221 Record r = (Record)Heap_poll(op->heap);
222 OpBase_DeleteRecord(r);
223 }
224 Heap_free(op->heap);
225 op->heap = NULL;
226 }
227
228 if(op->buffer) {
229 uint recordCount = array_len(op->buffer);
230 for(uint i = op->record_idx; i < recordCount; i++) {
231 Record r = op->buffer[i];
232 OpBase_DeleteRecord(r);
233 }
234 array_free(op->buffer);
235 op->buffer = NULL;
236 }
237
238 if(op->record_offsets) {
239 array_free(op->record_offsets);
240 op->record_offsets = NULL;
241 }
242
243 if(op->directions) {
244 array_free(op->directions);
245 op->directions = NULL;
246 }
247
248 if(op->exps) {
249 uint exps_count = array_len(op->exps);
250 for(uint i = 0; i < exps_count; i++) AR_EXP_Free(op->exps[i]);
251 array_free(op->exps);
252 op->exps = NULL;
253 }
254}

Callers

nothing calls this directly

Calls 7

Heap_countFunction · 0.85
Heap_pollFunction · 0.85
OpBase_DeleteRecordFunction · 0.85
Heap_freeFunction · 0.85
array_lenFunction · 0.85
array_freeFunction · 0.85
AR_EXP_FreeFunction · 0.85

Tested by

no test coverage detected