| 3963 | } |
| 3964 | |
| 3965 | hb_buffer_t* hb_buffer_list_rem(hb_buffer_list_t *list, hb_buffer_t * b) |
| 3966 | { |
| 3967 | hb_buffer_t * a; |
| 3968 | |
| 3969 | if (list == NULL) |
| 3970 | { |
| 3971 | return NULL; |
| 3972 | } |
| 3973 | if (b == list->head) |
| 3974 | { |
| 3975 | return hb_buffer_list_rem_head(list); |
| 3976 | } |
| 3977 | a = list->head; |
| 3978 | while (a != NULL && a->next != b) |
| 3979 | { |
| 3980 | a = a->next; |
| 3981 | } |
| 3982 | if (a == NULL) |
| 3983 | { |
| 3984 | // Buffer is not in the list |
| 3985 | return NULL; |
| 3986 | } |
| 3987 | list->count--; |
| 3988 | list->size -= b->size; |
| 3989 | a->next = b->next; |
| 3990 | if (list->tail == b) |
| 3991 | { |
| 3992 | list->tail = a; |
| 3993 | } |
| 3994 | b->next = NULL; |
| 3995 | |
| 3996 | return b; |
| 3997 | } |
| 3998 | |
| 3999 | hb_buffer_t* hb_buffer_list_head(hb_buffer_list_t *list) |
| 4000 | { |
no test coverage detected