From: David King Date: Wed, 17 Oct 2018 07:33:25 +0000 (+0100) Subject: dbus-send: Avoid duplicated-branches warning X-Git-Tag: dbus-1.13.8~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0bf0d185d72e20e70da9a98e13f69e19f2a87d5;p=thirdparty%2Fdbus.git dbus-send: Avoid duplicated-branches warning Switch the order of the argument checks to avoid the -Wduplicated-branches warning. Signed-off-by: David King Reviewed-by: Simon McVittie --- diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 6fb65fe05..efeb76e00 100644 --- a/tools/dbus-send.c +++ b/tools/dbus-send.c @@ -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 */ {