Skip to content

refactor: add string_array_to_vector helper - #821

Draft
milyin wants to merge 1 commit into
mainfrom
refactor/string-array-to-vector
Draft

milyin wants to merge 1 commit into
mainfrom
refactor/string-array-to-vector

Conversation

@milyin

@milyin milyin commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Link::get_interfaces() converts an owned C string array into a vector and releases the array manually. Extract that conversion into interop::detail::string_array_to_vector, which consumes the array and uses a scope guard to release it during exception unwinding as well.

Reuse the helper in Link::get_interfaces() and add regression coverage for empty arrays, empty strings, embedded NUL bytes, and independent C++ string ownership after the C array is released. Public API signatures are unchanged.

Validation:

  • zenoh-c: details_zenohc and strict warnings_zenohc tests passed.
  • zenoh-pico: the standalone helper regression cases passed against the installed library.
  • C++17 compilation with exceptions disabled passed for the helper on both backends.
  • clang-format 18.1.3 and git diff --check passed.

Related to #815, which also changes the cleanup in Link::get_interfaces() as part of a broader conversion-guard refactor.

Signed-off-by: Michael Ilyin <milyin@gmail.com>
@milyin
milyin marked this pull request as draft October 9, 2026 11:03
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