util/ht: add key-value pair iterator support#6483
Open
thiagomucci wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 36 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
b69fadb to
f997d92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
RZ_APIfunction and struct this PR changes.RZ_API).Detailed description
This pull request implements a Key-Value pair iterator for the generic hashtable API (
Ht_).It introduces two new functions to the Doxygen/C template architecture in
ht_inc.h:Ht_(as_iter_kv): Creates an iterator to traverse both keys and values.Ht_(iter_next_kv): Returns the nextHT_(Kv)element in the iteration.This allows developers to iterate over generic hashtables and access both keys and values simultaneously without needing separate lookups.
AI Disclosure: Gemini was used to debugging the Meson/Ninja local environment, and drafting the unit tests.
Test plan
I have created a dedicated unit test
test_ht_uu_iter_kvinsidetest/unit/test_ht.c. The test populates anHtUUtable, initializes the new KV iterator, and asserts that all pairs are traversed correctly.Test plan
To run and verify the test, i execute:
meson compile -C build
meson test -C build --suite util
...
Closing issues
Closes #6426
...