-
Notifications
You must be signed in to change notification settings - Fork 0
Add dmlist_find_next for resumable list search #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
… validate last_found Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
JohnAmadis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
przecież teraz zwykły find może być po prostu wrapperem na tę funkcję
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
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.