Merge pull request #12087 from yuwata/fix-condition-free-list

util: fix condition_free_list_type()
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-03-24 13:47:05 +01:00 committed by GitHub
commit fd7887da00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 11 deletions

View file

@ -81,7 +81,7 @@ typedef struct NetDev {
char *filename;
Condition *conditions;
LIST_HEAD(Condition, conditions);
NetDevState state;
NetDevKind kind;

View file

@ -97,7 +97,7 @@ struct Network {
char **match_driver;
char **match_type;
char **match_name;
Condition *conditions;
LIST_HEAD(Condition, conditions);
char *description;

View file

@ -77,17 +77,17 @@ void condition_free(Condition *c) {
free(c);
}
Condition* condition_free_list_type(Condition *first, ConditionType type) {
Condition *c, *n, *r = NULL;
Condition* condition_free_list_type(Condition *head, ConditionType type) {
Condition *c, *n;
LIST_FOREACH_SAFE(conditions, c, n, first)
if (type < 0 || c->type == type)
LIST_FOREACH_SAFE(conditions, c, n, head)
if (type < 0 || c->type == type) {
LIST_REMOVE(conditions, head, c);
condition_free(c);
else if (!r)
r = c;
}
assert(type >= 0 || !r);
return r;
assert(type >= 0 || !head);
return head;
}
static int condition_test_kernel_command_line(Condition *c) {

View file

@ -40,7 +40,7 @@ struct link_config {
char **match_driver;
char **match_type;
char **match_name;
Condition *conditions;
LIST_HEAD(Condition, conditions);
char *description;
struct ether_addr *mac;

View file

@ -0,0 +1,4 @@
[Match]
KernelVersion=t
Virtualization=q
KernelVersion=

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.