Skip to content

array: report missing reference on removal#84

Merged
edsiper merged 1 commit into
masterfrom
agent/array-remove-missing-reference
Jul 11, 2026
Merged

array: report missing reference on removal#84
edsiper merged 1 commit into
masterfrom
agent/array-remove-missing-reference

Conversation

@edsiper

@edsiper edsiper commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

Return -1 from cfl_array_remove_by_reference() when the supplied variant is not present in the array.

Add unit coverage using a variant owned by a different array and verify that the failed removal leaves it unchanged.

Rationale

The previous implementation returned 0 both when an element was removed and when no matching reference existed. Reporting the missing reference as an error makes the result meaningful and aligns it with cfl_array_remove_by_index() for an invalid position.

No production callers were found in CFL, cmetrics, ctraces, or Fluent Bit.

Validation

  • ctest --test-dir build-array-remove -R cfl-test-array --output-on-failure
  • ctest --test-dir build-array-remove --output-on-failure (34/34 passed)
  • git diff --check

Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
@edsiper edsiper marked this pull request as ready for review July 11, 2026 18:25
@edsiper edsiper merged commit c9f569c into master Jul 11, 2026
26 checks passed
@edsiper edsiper deleted the agent/array-remove-missing-reference branch July 11, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant