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:
Simon McVittie 2017-01-17 21:09:07 +00:00 committed by Simon McVittie
parent cb5a37b53b
commit e2edb6c4b8

View file

@ -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;
}