]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
bus policy: assert that no invalid rule types are seen
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 17 Jan 2017 21:09:07 +0000 (21:09 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 7 Apr 2017 11:08:48 +0000 (12:08 +0100)
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

bus/policy.c

index dd0ac869c9743eae33fb1946fa20b543d83c3b53..b5cca35a115b8a82a1064dea5254cce58b8a321a 100644 (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;
         }