tree-wide: replace FLAGS_SET(..., 1 << v) with BIT_SET(..., v)

This commit is contained in:
Mike Yuan
2024-12-28 15:08:00 +01:00
parent 382f3438d9
commit 1e4e557262
23 changed files with 77 additions and 60 deletions
+3 -5
View File
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bitfield.h"
#include "condition.h"
#include "conf-parser.h"
#include "escape.h"
@@ -38,12 +39,9 @@ int network_config_state_to_string_alloc(NetworkConfigState s, char **ret) {
assert(ret);
for (size_t i = 0; i < ELEMENTSOF(states); i++)
if (FLAGS_SET(s, 1 << i)) {
assert(states[i]);
if (!strextend_with_separator(&buf, ",", states[i]))
if (BIT_SET(s, i))
if (!strextend_with_separator(&buf, ",", ASSERT_PTR(states[i])))
return -ENOMEM;
}
*ret = TAKE_PTR(buf);
return 0;