X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fcondition-util.c;h=7b89b0fbafe1e3eebd1832ca01f79e5f4c9f99b0;hb=30d7c9c472bd7be1b6a09d3bd5afd939988de990;hp=4aea3caf9d59422c35fe914a75bc578c12c15f8a;hpb=099524d7b0df690e3361ffc3fe3c6aed0558b4fc;p=elogind.git diff --git a/src/shared/condition-util.c b/src/shared/condition-util.c index 4aea3caf9..7b89b0fba 100644 --- a/src/shared/condition-util.c +++ b/src/shared/condition-util.c @@ -121,8 +121,7 @@ bool condition_test_kernel_command_line(Condition *c) { } bool condition_test_virtualization(Condition *c) { - int b; - Virtualization v; + int b, v; const char *id; assert(c); @@ -178,10 +177,9 @@ bool condition_test_architecture(Condition *c) { } bool condition_test_host(Condition *c) { + _cleanup_free_ char *h = NULL; sd_id128_t x, y; - char *h; int r; - bool b; assert(c); assert(c->parameter); @@ -200,10 +198,7 @@ bool condition_test_host(Condition *c) { if (!h) return c->negate; - b = fnmatch(c->parameter, h, FNM_CASEFOLD) == 0; - free(h); - - return b == !c->negate; + return (fnmatch(c->parameter, h, FNM_CASEFOLD) == 0) == !c->negate; } bool condition_test_ac_power(Condition *c) { @@ -261,6 +256,7 @@ static const char* const condition_type_table[_CONDITION_TYPE_MAX] = { [CONDITION_HOST] = "ConditionHost", [CONDITION_AC_POWER] = "ConditionACPower", [CONDITION_ARCHITECTURE] = "ConditionArchitecture", + [CONDITION_NEEDS_UPDATE] = "ConditionNeedsUpdate", [CONDITION_NULL] = "ConditionNull" };