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

Function Proc_SSpathsStep

src/procedures/proc_ss_paths.c:678–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678static SIValue *Proc_SSpathsStep
679(
680 ProcedureCtx *ctx
681) {
682 ASSERT(ctx->privateData != NULL);
683
684 SingleSourceCtx *single_source_ctx = ctx->privateData;
685 WeightedPath p;
686
687 if(single_source_ctx->path_count == 0) {
688 if(array_len(single_source_ctx->array) == 0) return NULL;
689
690 p = array_pop(single_source_ctx->array);
691 } else if(single_source_ctx->path_count == 1) {
692 p = single_source_ctx->single;
693 if(p.path == NULL) return NULL;
694
695 single_source_ctx->single.path = NULL;
696 } else {
697 WeightedPath *pp = Heap_poll(single_source_ctx->heap);
698 if(pp == NULL) return NULL;
699
700 p = *pp;
701 rm_free(pp);
702 }
703
704 if(single_source_ctx->yield_path) {
705 *single_source_ctx->yield_path = SI_Path(p.path);
706 Path_Free(p.path);
707 }
708 if(single_source_ctx->yield_path_weight) *single_source_ctx->yield_path_weight = SI_DoubleVal(p.weight);
709 if(single_source_ctx->yield_path_cost) *single_source_ctx->yield_path_cost = SI_DoubleVal(p.cost);
710
711 return single_source_ctx->output;
712}
713
714static ProcedureResult Proc_SSpathsFree
715(

Callers

nothing calls this directly

Calls 6

array_lenFunction · 0.85
Heap_pollFunction · 0.85
rm_freeFunction · 0.85
SI_PathFunction · 0.85
Path_FreeFunction · 0.85
SI_DoubleValFunction · 0.85

Tested by

no test coverage detected