mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 09:58:07 +02:00
bus policy: assert that no invalid rule types are seen
This silences -Wswitch-default. Based on part of a patch from Thomas Zimmermann. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98191
This commit is contained in:
parent
cb5a37b53b
commit
e2edb6c4b8
1 changed files with 10 additions and 0 deletions
10
bus/policy.c
10
bus/policy.c
|
|
@ -69,6 +69,8 @@ bus_policy_rule_new (BusPolicyRuleType type,
|
|||
break;
|
||||
case BUS_POLICY_RULE_OWN:
|
||||
break;
|
||||
default:
|
||||
_dbus_assert_not_reached ("invalid rule");
|
||||
}
|
||||
|
||||
return rule;
|
||||
|
|
@ -116,6 +118,8 @@ bus_policy_rule_unref (BusPolicyRule *rule)
|
|||
break;
|
||||
case BUS_POLICY_RULE_GROUP:
|
||||
break;
|
||||
default:
|
||||
_dbus_assert_not_reached ("invalid rule");
|
||||
}
|
||||
|
||||
dbus_free (rule);
|
||||
|
|
@ -261,6 +265,9 @@ add_list_to_client (DBusList **list,
|
|||
if (!bus_client_policy_append_rule (client, rule))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
_dbus_assert_not_reached ("invalid rule");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -830,8 +837,11 @@ bus_client_policy_optimize (BusClientPolicy *policy)
|
|||
remove_preceding =
|
||||
rule->d.own.service_name == NULL;
|
||||
break;
|
||||
|
||||
/* The other rule types don't appear in this list */
|
||||
case BUS_POLICY_RULE_USER:
|
||||
case BUS_POLICY_RULE_GROUP:
|
||||
default:
|
||||
_dbus_assert_not_reached ("invalid rule");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue