[Spice-devel] [PATCH spice-server v2 4/8] fixup! Use macros for casting Channel types

Frediano Ziglio fziglio at redhat.com
Mon Oct 10 16:11:10 UTC 2016


Use parenthesis to enclose macro parameters.
More CURSOR_CHANNEL to implementation, not used externally.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/cursor-channel.c  | 2 ++
 server/cursor-channel.h  | 1 -
 server/display-channel.h | 2 +-
 server/inputs-channel.h  | 3 ++-
 server/main-channel.h    | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 85a7fe5..e84b593 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -27,6 +27,8 @@
 #include "cursor-channel-client.h"
 #include "reds.h"
 
+#define CURSOR_CHANNEL(channel) ((CursorChannel*)(channel))
+
 typedef struct CursorChannelClient CursorChannelClient;
 
 enum {
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index 0f2b43d..a3ddaa3 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -20,7 +20,6 @@
 
 #include "common-graphics-channel.h"
 
-#define CURSOR_CHANNEL(channel) ((CursorChannel*)channel)
 /**
  * This type it's a RedChannel class which implement cursor (mouse)
  * movements.
diff --git a/server/display-channel.h b/server/display-channel.h
index 998970e..3762e54 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -45,7 +45,7 @@
 #include "image-encoders.h"
 #include "common-graphics-channel.h"
 
-#define DISPLAY_CHANNEL(channel) ((DisplayChannel*)channel)
+#define DISPLAY_CHANNEL(channel) ((DisplayChannel*)(channel))
 
 typedef struct DependItem {
     Drawable *drawable;
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index 7001094..ae84eed 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -26,7 +26,8 @@
 
 #include "red-channel.h"
 
-#define INPUTS_CHANNEL(channel) ((InputsChannel*)channel)
+#define INPUTS_CHANNEL(channel) ((InputsChannel*)(channel))
+
 typedef struct InputsChannel InputsChannel;
 
 InputsChannel* inputs_channel_new(RedsState *reds);
diff --git a/server/main-channel.h b/server/main-channel.h
index caea014..e0858d0 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -25,7 +25,7 @@
 #include "red-channel.h"
 #include "main-channel-client.h"
 
-#define MAIN_CHANNEL(channel) ((MainChannel*)channel)
+#define MAIN_CHANNEL(channel) ((MainChannel*)(channel))
 
 // TODO: Defines used to calculate receive buffer size, and also by reds.c
 // other options: is to make a reds_main_consts.h, to duplicate defines.
-- 
2.7.4



More information about the Spice-devel mailing list