Skip to content

Commit ac66e8c

Browse files
CopilotJohnAmadis
andcommitted
Refactor dmlist_find to be a wrapper for dmlist_find_next
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
1 parent 036fd79 commit ac66e8c

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

src/dmlist.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -283,22 +283,7 @@ DMOD_INPUT_API_DECLARATION( dmlist, 1.0, void, _clear, ( dmlist_context_t* ctx )
283283

284284
DMOD_INPUT_API_DECLARATION( dmlist, 1.0, void*, _find, ( dmlist_context_t* ctx, const void* data, dmlist_compare_func_t compare_func ) )
285285
{
286-
if( ctx == NULL || compare_func == NULL )
287-
{
288-
return NULL;
289-
}
290-
291-
dmlist_node_t* current = ctx->head;
292-
while( current != NULL )
293-
{
294-
if( compare_func( current->data, data ) == 0 )
295-
{
296-
return current->data;
297-
}
298-
current = current->next;
299-
}
300-
301-
return NULL;
286+
return dmlist_find_next( ctx, NULL, data, compare_func );
302287
}
303288

304289
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 ) )

0 commit comments

Comments
 (0)