Add dmlist_find_next for resumable list search#10
Merged
JohnAmadis merged 4 commits intomasterfrom Dec 29, 2025
Merged
Conversation
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
… validate last_found Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add find_next function to DMLIST
Add dmlist_find_next for resumable list search
Dec 29, 2025
JohnAmadis
requested changes
Dec 29, 2025
Contributor
JohnAmadis
left a comment
There was a problem hiding this comment.
@copilot popraw to proszę
| return NULL; | ||
| } | ||
|
|
||
| DMOD_INPUT_API_DECLARATION( dmlist, 1.0, void*, _find_next, ( dmlist_context_t* ctx, const void* last_found, const void* data, dmlist_compare_func_t compare_func ) ) |
Contributor
There was a problem hiding this comment.
przecież teraz zwykły find może być po prostu wrapperem na tę funkcję
Contributor
Author
There was a problem hiding this comment.
Masz rację! Zrefaktorowałem kod - teraz dmlist_find jest prostym wrapperem który wywołuje dmlist_find_next(ctx, NULL, data, compare_func). To eliminuje duplikację kodu. (ac66e8c)
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Contributor
Author
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.
Plan for implementing dmlist_find_next
dmlist_find_nextfunction declaration ininclude/dmlist.hdmlist_find_nextfunction insrc/dmlist.cdmlist_find_nextintests/test_simple.cdmlist_findto usedmlist_find_nextwrapperSummary
Successfully implemented
dmlist_find_nextfunction and refactoreddmlist_findto eliminate code duplication.Implementation Details:
void* dmlist_find_next(dmlist_context_t* ctx, const void* last_found, const void* data, dmlist_compare_func_t compare_func)last_foundis NULL, starts searching from the beginning of the listlast_foundis not NULL, validates it exists in the list and continues searching from the next nodelast_foundis not found in the list (security feature)dmlist_findnow simply callsdmlist_find_next(ctx, NULL, data, compare_func), eliminating duplicate codeTest Coverage:
last_foundlast_foundpointerdmlist_findwhenlast_foundis NULLQuality Checks:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.