[PATCH wayland] wl-utils: wl_list_insert_list
ppaalanen at gmail.com
Fri Mar 31 07:45:14 UTC 2017
On Fri, 31 Mar 2017 00:01:18 +0000
Oktay Sarimehmet <oktay4st at gmail.com> wrote:
> It doesnt add an element which is adressed as other`s adress.
> Signed-off-by: Oktay Sarimehmet <oktay4st at gmail.com>
> src/wayland-util.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> diff --git a/src/wayland-util.c b/src/wayland-util.c
> index cab7fc5..50c52b2 100644
> --- a/src/wayland-util.c
> +++ b/src/wayland-util.c
> @@ -87,8 +87,8 @@ wl_list_insert_list(struct wl_list *list, struct wl_list *other)
> other->next->prev = list;
> - other->prev->next = list->next;
> - list->next->prev = other->prev;
> + other->next = list->next;
> + list->next->prev = other;
> list->next = other->next;
this function is very heavily used, so it's hard to believe it'd be
broken. The function is supposed to add the whole list 'other' to the
beginning of 'list'.
The original code is correct. 'other' is intentionally left in invalid
state and needs to be wl_list_init()'d before using again.
'other' is a list head, and must not be part of the list in 'list',
because a head is not the same type as an item in the list: you cannot
cast a list head element into a type stored in the list as items.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 833 bytes
Desc: OpenPGP digital signature
More information about the wayland-devel