forked from osmocom/wireshark
Adds wmem_list_find function
Change-Id: I72162210b830a57978e108032d75d8c54f17d16b Reviewed-on: https://code.wireshark.org/review/12387 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
be04716601
commit
0d3f77fff1
|
@ -113,6 +113,19 @@ wmem_list_remove_frame(wmem_list_t *list, wmem_list_frame_t *frame)
|
|||
wmem_free(list->allocator, frame);
|
||||
}
|
||||
|
||||
wmem_list_frame_t *
|
||||
wmem_list_find(wmem_list_t *list, const void *data)
|
||||
{
|
||||
wmem_list_frame_t *cur;
|
||||
|
||||
for (cur = list->head; cur; cur = cur->next) {
|
||||
if(cur->data == data)
|
||||
return cur;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
wmem_list_prepend(wmem_list_t *list, void *data)
|
||||
{
|
||||
|
|
|
@ -80,6 +80,13 @@ WS_DLL_PUBLIC
|
|||
void
|
||||
wmem_list_remove_frame(wmem_list_t *list, wmem_list_frame_t *frame);
|
||||
|
||||
/*
|
||||
* Linear search, search is O(n)
|
||||
*/
|
||||
WS_DLL_PUBLIC
|
||||
wmem_list_frame_t *
|
||||
wmem_list_find(wmem_list_t *list, const void *data);
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
void
|
||||
wmem_list_prepend(wmem_list_t *list, void *data);
|
||||
|
|
Loading…
Reference in New Issue