From 0e2913edd72ac20d40f18aed2c9b891f780cfa9d Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Wed, 27 May 2026 14:02:19 +0900 Subject: [PATCH 19/26] Change nfa_add_state_unique signature from bool to void The return value is leftover from an earlier design. All four callers ignore it, and the duplicate-found case is fully handled inside the function (the new state is freed and nfaStatesMerged is incremented). Drop the return value and update the doc comment. --- src/backend/executor/execRPR.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/backend/executor/execRPR.c b/src/backend/executor/execRPR.c index 261e1209744..88c59cf3276 100644 --- a/src/backend/executor/execRPR.c +++ b/src/backend/executor/execRPR.c @@ -61,7 +61,7 @@ static RPRNFAState *nfa_state_create(WindowAggState *winstate, int16 elemIdx, int32 *counts, bool sourceAbsorbable); static bool nfa_states_equal(WindowAggState *winstate, RPRNFAState *s1, RPRNFAState *s2); -static bool nfa_add_state_unique(WindowAggState *winstate, RPRNFAContext *ctx, +static void nfa_add_state_unique(WindowAggState *winstate, RPRNFAContext *ctx, RPRNFAState *state); static void nfa_add_matched_state(WindowAggState *winstate, RPRNFAContext *ctx, RPRNFAState *state, int64 matchEndRow); @@ -335,10 +335,10 @@ nfa_states_equal(WindowAggState *winstate, RPRNFAState *s1, RPRNFAState *s2) * nfa_add_state_unique * * Add a state to ctx->states at the END, only if no duplicate exists. - * Returns true if state was added, false if duplicate found (state is freed). - * Earlier states have better lexical order (DFS traversal order), so existing wins. + * Earlier states have better lexical order (DFS traversal order), so existing + * wins; the new state is freed when a duplicate is found. */ -static bool +static void nfa_add_state_unique(WindowAggState *winstate, RPRNFAContext *ctx, RPRNFAState *state) { RPRNFAState *s; @@ -365,7 +365,7 @@ nfa_add_state_unique(WindowAggState *winstate, RPRNFAContext *ctx, RPRNFAState * */ nfa_state_free(winstate, state); winstate->nfaStatesMerged++; - return false; + return; } tail = s; } @@ -376,8 +376,6 @@ nfa_add_state_unique(WindowAggState *winstate, RPRNFAContext *ctx, RPRNFAState * ctx->states = state; else tail->next = state; - - return true; } /* -- 2.50.1 (Apple Git-155)