static int condition_test_kernel_command_line(Condition *c, char **env) {
_cleanup_free_ char *line = NULL;
- const char *p;
- bool equal;
int r;
assert(c);
if (r < 0)
return r;
- equal = strchr(c->parameter, '=');
+ bool equal = strchr(c->parameter, '=');
- for (p = line;;) {
+ for (const char *p = line;;) {
_cleanup_free_ char *word = NULL;
bool found;
} OrderOperator;
static OrderOperator parse_order(const char **s) {
-
static const char *const prefix[_ORDER_MAX] = {
[ORDER_LOWER_OR_EQUAL] = "<=",
[ORDER_GREATER_OR_EQUAL] = ">=",
[ORDER_UNEQUAL] = "!=",
};
- OrderOperator i;
-
- for (i = 0; i < _ORDER_MAX; i++) {
+ for (OrderOperator i = 0; i < _ORDER_MAX; i++) {
const char *e;
e = startswith(*s, prefix[i]);
static int condition_test_kernel_version(Condition *c, char **env) {
OrderOperator order;
struct utsname u;
- const char *p;
bool first = true;
assert(c);
assert_se(uname(&u) >= 0);
- p = c->parameter;
-
- for (;;) {
+ for (const char *p = c->parameter;;) {
_cleanup_free_ char *word = NULL;
const char *s;
int r;
}
static int condition_test_osrelease(Condition *c, char **env) {
- const char *parameter = c->parameter;
int r;
assert(c);
- assert(c->parameter);
assert(c->type == CONDITION_OS_RELEASE);
- for (;;) {
+ for (const char *parameter = ASSERT_PTR(c->parameter);;) {
_cleanup_free_ char *key = NULL, *condition = NULL, *actual_value = NULL;
OrderOperator order;
const char *word;
for (;;) {
_cleanup_free_ char *line = NULL;
- const char *p;
r = read_line(f, LONG_LINE_MAX, &line);
if (r < 0)
if (r == 0)
break;
- p = startswith(line, "CapBnd:");
+ const char *p = startswith(line, "CapBnd:");
if (p) {
- if (sscanf(line+7, "%llx", &capabilities) != 1)
+ if (sscanf(p, "%llx", &capabilities) != 1)
return -EIO;
break;