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

Function Proc_SPpathsStep

src/procedures/proc_sp_paths.c:687–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687static SIValue *Proc_SPpathsStep
688(
689 ProcedureCtx *ctx
690) {
691 ASSERT(ctx->privateData != NULL);
692
693 SinglePairCtx *single_pair_ctx = ctx->privateData;
694 WeightedPath p;
695
696 if(single_pair_ctx->path_count == 0) {
697 if(array_len(single_pair_ctx->array) == 0) return NULL;
698
699 p = array_pop(single_pair_ctx->array);
700 } else if(single_pair_ctx->path_count == 1) {
701 p = single_pair_ctx->single;
702 if(p.path == NULL) return NULL;
703
704 single_pair_ctx->single.path = NULL;
705 } else {
706 WeightedPath *pp = Heap_poll(single_pair_ctx->heap);
707 if(pp == NULL) return NULL;
708
709 p = *pp;
710 rm_free(pp);
711 }
712
713 if(single_pair_ctx->yield_path) {
714 *single_pair_ctx->yield_path = SI_Path(p.path);
715 Path_Free(p.path);
716 }
717 if(single_pair_ctx->yield_path_weight) *single_pair_ctx->yield_path_weight = SI_DoubleVal(p.weight);
718 if(single_pair_ctx->yield_path_cost) *single_pair_ctx->yield_path_cost = SI_DoubleVal(p.cost);
719
720 return single_pair_ctx->output;
721}
722
723static ProcedureResult Proc_SPpathsFree
724(

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