Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-30 Thread Peter Hutterer
On Tue, Jun 30, 2015 at 02:22:34PM +0200, Hans de Goede wrote: > Hi Peter, > > On 29-06-15 05:49, Peter Hutterer wrote: > >Don't require a list_init() on a node before we can call list_remove on it, > >it > >clutters up the code for little benefit. > > > >Signed-off-by: Peter Hutterer > >--- > >

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-30 Thread Bill Spitzak
On Tue, Jun 30, 2015 at 5:22 AM, Hans de Goede wrote: > > + if (elm->next == NULL && elm->prev == NULL) >> + return; >> + >> elm->prev->next = elm->next; >> elm->next->prev = elm->prev; >> elm->next = NULL; >> >> > I do not think this is a good idea, mo

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-30 Thread Hans de Goede
Hi Peter, On 29-06-15 05:49, Peter Hutterer wrote: Don't require a list_init() on a node before we can call list_remove on it, it clutters up the code for little benefit. Signed-off-by: Peter Hutterer --- src/libinput-util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libinpu

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-29 Thread Pekka Paalanen
On Mon, 29 Jun 2015 13:49:21 +1000 Peter Hutterer wrote: > Don't require a list_init() on a node before we can call list_remove on it, it > clutters up the code for little benefit. > > Signed-off-by: Peter Hutterer > --- > src/libinput-util.c | 3 +++ > 1 file changed, 3 insertions(+) > > dif

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-29 Thread Jon A. Cruz
On 06/29/2015 04:32 PM, Peter Hutterer wrote: > On Mon, Jun 29, 2015 at 04:00:51PM -0700, Ping Cheng wrote: >> I guess Bill meant "||" should be used instead of "&&"? One of the == NULL >> would lead to a crash... > > that'd would hide potential memory corruption or other bugs and won't show > up

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-29 Thread Peter Hutterer
On Mon, Jun 29, 2015 at 04:00:51PM -0700, Ping Cheng wrote: > On Mon, Jun 29, 2015 at 3:09 PM, Peter Hutterer > wrote: > > > On Mon, Jun 29, 2015 at 12:37:26PM -0700, Bill Spitzak wrote: > > > On Sun, Jun 28, 2015 at 8:49 PM, Peter Hutterer < > > peter.hutte...@who-t.net> > > > wrote: > > > > > >

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-29 Thread Ping Cheng
On Mon, Jun 29, 2015 at 3:09 PM, Peter Hutterer wrote: > On Mon, Jun 29, 2015 at 12:37:26PM -0700, Bill Spitzak wrote: > > On Sun, Jun 28, 2015 at 8:49 PM, Peter Hutterer < > peter.hutte...@who-t.net> > > wrote: > > > > > > > > + if (elm->next == NULL && elm->prev == NULL) > > > +

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-29 Thread Peter Hutterer
On Mon, Jun 29, 2015 at 12:37:26PM -0700, Bill Spitzak wrote: > On Sun, Jun 28, 2015 at 8:49 PM, Peter Hutterer > wrote: > > > > > + if (elm->next == NULL && elm->prev == NULL) > > + return; > > + > > elm->prev->next = elm->next; > > elm->next->prev = elm->prev

Re: [PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-29 Thread Bill Spitzak
On Sun, Jun 28, 2015 at 8:49 PM, Peter Hutterer wrote: > > + if (elm->next == NULL && elm->prev == NULL) > + return; > + > elm->prev->next = elm->next; > elm->next->prev = elm->prev; > elm->next = NULL; > You probably don't need to check both pointers

[PATCH libinput 1/5] util: allow list_remove() on a NULL node

2015-06-28 Thread Peter Hutterer
Don't require a list_init() on a node before we can call list_remove on it, it clutters up the code for little benefit. Signed-off-by: Peter Hutterer --- src/libinput-util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libinput-util.c b/src/libinput-util.c index 3a9c8db..f19695c 10