diff options
author | David King <dking@redhat.com> | 2018-10-17 08:33:25 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2019-04-17 13:38:05 +0100 |
commit | 2fb62561f0304a0f550d828513c09818c804023a (patch) | |
tree | 242b5962a9c260ffceb9cf916b8ab79edf2773f9 /tools | |
parent | 2e4a72ed51684225c8de7047e415744c2113ed6d (diff) | |
download | dbus-2fb62561f0304a0f550d828513c09818c804023a.tar.gz dbus-2fb62561f0304a0f550d828513c09818c804023a.tar.bz2 dbus-2fb62561f0304a0f550d828513c09818c804023a.zip |
dbus-send: Avoid duplicated-branches warning
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>
(cherry picked from commit c0bf0d185d72e20e70da9a98e13f69e19f2a87d5)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dbus-send.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/dbus-send.c b/tools/dbus-send.c index 6fb65fe0..efeb76e0 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 */ { |