diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-04-20 04:04:03 +0900 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-04-20 09:20:08 +0200 |
commit | 24a5370bbc1b52fee52d8891f66af13e9d77d799 (patch) | |
tree | 8cb61c060db5f687349b6f371a5c8c5541e54fd7 /src | |
parent | 59e4eeed7819c05c57d52e268ab459a00a28ea27 (diff) | |
download | systemd-24a5370bbc1b52fee52d8891f66af13e9d77d799.tar.gz |
list: fix double evaluation
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/list.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/basic/list.h b/src/basic/list.h index ffc8bd8304..e4e5dff3ea 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 |