[spice-server v2 6/6] Introduce WriteBufferOrigin enum typedef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This use to be an anonymous enum, used as an int in
RedCharDeviceWriteBufferPrivate::origin.
Introducing a typedef clarifies what kind of value it's holding.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 server/char-device.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/server/char-device.c b/server/char-device.c
index 481ea2a13..43e8d544d 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -31,8 +31,15 @@
 #define RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000
 #define MAX_POOL_SIZE (10 * 64 * 1024)
 
+typedef enum {
+    WRITE_BUFFER_ORIGIN_NONE,
+    WRITE_BUFFER_ORIGIN_CLIENT,
+    WRITE_BUFFER_ORIGIN_SERVER,
+    WRITE_BUFFER_ORIGIN_SERVER_NO_TOKEN,
+} WriteBufferOrigin;
+
 struct RedCharDeviceWriteBufferPrivate {
-    int origin;
+    WriteBufferOrigin origin;
     RedClient *client; /* The client that sent the message to the device.
                           NULL if the server created the message */
     uint32_t token_price;
@@ -77,14 +84,6 @@ struct RedCharDevicePrivate {
     SpiceServer *reds;
 };
 
-enum {
-    WRITE_BUFFER_ORIGIN_NONE,
-    WRITE_BUFFER_ORIGIN_CLIENT,
-    WRITE_BUFFER_ORIGIN_SERVER,
-    WRITE_BUFFER_ORIGIN_SERVER_NO_TOKEN,
-};
-
-
 G_DEFINE_TYPE(RedCharDevice, red_char_device, G_TYPE_OBJECT)
 
 #define RED_CHAR_DEVICE_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RED_TYPE_CHAR_DEVICE, RedCharDevicePrivate))
@@ -536,7 +535,7 @@ static void red_char_device_write_retry(void *opaque)
 
 static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
     RedCharDevice *dev, RedClient *client,
-    int size, int origin, int migrated_data_tokens)
+    int size, WriteBufferOrigin origin, int migrated_data_tokens)
 {
     RedCharDeviceWriteBuffer *ret;
 
@@ -651,7 +650,7 @@ void red_char_device_write_buffer_release(RedCharDevice *dev,
     }
     *p_write_buf = NULL;
 
-    int buf_origin = write_buf->priv->origin;
+    WriteBufferOrigin buf_origin = write_buf->priv->origin;
     uint32_t buf_token_price = write_buf->priv->token_price;
     RedClient *client = write_buf->priv->client;
 
-- 
2.12.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]