From: Olivier Houchard Date: Fri, 20 Sep 2019 12:44:22 +0000 (+0200) Subject: MINOR: mt_lists: Do nothing in MT_LIST_ADD/MT_LIST_ADDQ if already in list. X-Git-Tag: v2.1-dev2~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb22ad4f7191960e28f457c064ca2d8e6328fc12;p=thirdparty%2Fhaproxy.git MINOR: mt_lists: Do nothing in MT_LIST_ADD/MT_LIST_ADDQ if already in list. Modify MT_LIST_ADD and MT_LIST_ADDQ to do nothing if the element is already in a list. --- diff --git a/include/common/mini-clist.h b/include/common/mini-clist.h index 642a7a36a5..3d519197e4 100644 --- a/include/common/mini-clist.h +++ b/include/common/mini-clist.h @@ -221,6 +221,11 @@ struct cond_wordlist { __ha_barrier_store(); \ continue; \ } \ + if ((el)->next != (el) || (el)->prev != (el)) { \ + (n)->prev = p; \ + (lh)->next = n; \ + break; \ + } \ (el)->next = n; \ (el)->prev = p; \ __ha_barrier_store(); \ @@ -246,6 +251,11 @@ struct cond_wordlist { __ha_barrier_store(); \ continue; \ } \ + if ((el)->next != (el) || (el)->prev != (el)) { \ + p->next = n; \ + (lh)->prev = p; \ + break; \ + } \ (el)->next = n; \ (el)->prev = p; \ __ha_barrier_store(); \