From: Yu Watanabe Date: Wed, 19 Apr 2023 19:04:03 +0000 (+0900) Subject: list: fix double evaluation X-Git-Tag: v254-rc1~680 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24a5370bbc1b52fee52d8891f66af13e9d77d799;p=thirdparty%2Fsystemd.git list: fix double evaluation --- diff --git a/src/basic/list.h b/src/basic/list.h index ffc8bd83045..e4e5dff3ea2 100644 --- a/src/basic/list.h +++ b/src/basic/list.h @@ -46,7 +46,7 @@ /* Remove an item from the list */ #define LIST_REMOVE(name,head,item) \ - ({ \ + ({ \ typeof(*(head)) **_head = &(head), *_item = (item); \ assert(_item); \ if (_item->name##_next) \ @@ -127,8 +127,11 @@ _b; \ }) -#define LIST_JUST_US(name,item) \ - (!(item)->name##_prev && !(item)->name##_next) +#define LIST_JUST_US(name, item) \ + ({ \ + typeof(*(item)) *_item = (item); \ + !(_item)->name##_prev && !(_item)->name##_next; \ + }) /* The type of the iterator 'i' is automatically determined by the type of 'head', and declared in the * loop. Hence, do not declare the same variable in the outer scope. Sometimes, we set 'head' through