[Spice-commits] server/red-channel.c server/red-channel.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon Sep 26 12:47:29 UTC 2016


 server/red-channel.c |   10 ----------
 server/red-channel.h |    5 ++++-
 2 files changed, 4 insertions(+), 11 deletions(-)

New commits:
commit 46a4543d9d852dc0b299edfdc8dae2f8d5d38af1
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Sep 26 12:25:42 2016 +0100

    Reuse VD_AGENT_HAS_CAPABILITY macro for bit array
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/server/red-channel.c b/server/red-channel.c
index 927e6e9..af49824 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -329,16 +329,6 @@ void red_channel_register_client_cbs(RedChannel *channel, const ClientCbs *clien
     channel->data = cbs_data;
 }
 
-int test_capability(const uint32_t *caps, int num_caps, uint32_t cap)
-{
-    uint32_t index = cap / 32;
-    if (num_caps < index + 1) {
-        return FALSE;
-    }
-
-    return (caps[index] & (1 << (cap % 32))) != 0;
-}
-
 static void add_capability(uint32_t **caps, int *num_caps, uint32_t cap)
 {
     int nbefore, n;
diff --git a/server/red-channel.h b/server/red-channel.h
index def5de0..fc59dee 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -189,7 +189,10 @@ typedef struct RedChannelCapabilities {
     uint32_t *caps;
 } RedChannelCapabilities;
 
-int test_capability(const uint32_t *caps, int num_caps, uint32_t cap);
+static inline gboolean test_capability(const uint32_t *caps, int num_caps, uint32_t cap)
+{
+    return VD_AGENT_HAS_CAPABILITY(caps, num_caps, cap);
+}
 
 typedef struct RedChannelClientLatencyMonitor {
     int state;


More information about the Spice-commits mailing list