]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-send: Avoid duplicated-branches warning
authorDavid King <dking@redhat.com>
Wed, 17 Oct 2018 07:33:25 +0000 (08:33 +0100)
committerSimon McVittie <smcv@collabora.com>
Thu, 18 Oct 2018 11:36:03 +0000 (12:36 +0100)
Switch the order of the argument checks to avoid the
-Wduplicated-branches warning.

Signed-off-by: David King <dking@redhat.com>
Reviewed-by: Simon McVittie <smcv@collabora.com>
tools/dbus-send.c

index 6fb65fe053d3e706bbee42697f46a7ebcd2b7d3c..efeb76e0087611ad6711d262b5766db0f4e8adb3 100644 (file)
@@ -289,13 +289,16 @@ main (int argc, char *argv[])
         }
       else if ((strstr (arg, "--bus=") == arg) || (strstr (arg, "--peer=") == arg) || (strstr (arg, "--address=") == arg))
         {
-          if (arg[2] == 'b') /* bus */
+          /* Check for peer first, to avoid the GCC -Wduplicated-branches
+           * warning.
+           */
+          if (arg[2] == 'p') /* peer */
             {
-              is_bus = TRUE;
+              is_bus = FALSE;
             }
-          else if (arg[2] == 'p') /* peer */
+          else if (arg[2] == 'b') /* bus */
             {
-              is_bus = FALSE;
+              is_bus = TRUE;
             }
           else /* address; keeping backwards compatibility */
             {