[Spice-devel] [PATCH 04/18] Reuse VD_AGENT_HAS_CAPABILITY macro for bit array

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 08:12:37 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-channel.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/server/red-channel.c b/server/red-channel.c
index 927e6e9..27c8632 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -331,12 +331,7 @@ void red_channel_register_client_cbs(RedChannel *channel, const ClientCbs *clien
 
 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;
+    return VD_AGENT_HAS_CAPABILITY(caps, num_caps, cap);
 }
 
 static void add_capability(uint32_t **caps, int *num_caps, uint32_t cap)
-- 
2.7.4



More information about the Spice-devel mailing list