[Spice-commits] src/channel-main.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Apr 26 20:03:15 UTC 2020


 src/channel-main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73261cc720fa05910e9b8ace6878b6bcb9918fb8
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Thu Mar 19 15:47:13 2020 +0000

    channel-main: Simplify NAME macro
    
    Avoid one ternary operator inside another ternary operator.
    Also remove no-C syntax.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Francesco Giudici <fgiudici at redhat.com>

diff --git a/src/channel-main.c b/src/channel-main.c
index c6f1ba4..2dbe46b 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -225,7 +225,7 @@ static const char *agent_caps[] = {
     [ VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB ] = "no release on re-grab",
     [ VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL ] = "clipboard grab serial",
 };
-#define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) ? (_a[(_i)] ?: "?") : "?")
+#define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) && _a[_i] != NULL ? _a[_i] : "?")
 
 /* ------------------------------------------------------------------ */
 


More information about the Spice-commits mailing list