[Spice-devel] [PATCH 4/4] Remove useless pack attribute

Frediano Ziglio fziglio at redhat.com
Fri Aug 28 02:25:52 PDT 2015


From: Marc-André Lureau <marcandre.lureau at gmail.com>

---
 server/red_worker.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index c83f13e..e7ee6b6 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -46,6 +46,7 @@
 #include <setjmp.h>
 #include <openssl/ssl.h>
 #include <inttypes.h>
+#include <glib.h>
 
 #include <spice/protocol.h>
 #include <spice/qxl_dev.h>
@@ -5930,35 +5931,24 @@ static inline void red_init_zlib(RedWorker *worker)
     }
 }
 
-#ifdef __GNUC__
-#define ATTR_PACKED __attribute__ ((__packed__))
-#else
-#define ATTR_PACKED
-#pragma pack(push)
-#pragma pack(1)
-#endif
-
-
-typedef struct ATTR_PACKED rgb32_pixel_t {
+typedef struct {
     uint8_t b;
     uint8_t g;
     uint8_t r;
     uint8_t pad;
 } rgb32_pixel_t;
 
-typedef struct ATTR_PACKED rgb24_pixel_t {
+G_STATIC_ASSERT(sizeof(rgb32_pixel_t) == 4);
+
+typedef struct {
     uint8_t b;
     uint8_t g;
     uint8_t r;
 } rgb24_pixel_t;
 
-typedef uint16_t rgb16_pixel_t;
+G_STATIC_ASSERT(sizeof(rgb24_pixel_t) == 3);
 
-#ifndef __GNUC__
-#pragma pack(pop)
-#endif
-
-#undef ATTR_PACKED
+typedef uint16_t rgb16_pixel_t;
 
 #define RED_BITMAP_UTILS_RGB16
 #include "red_bitmap_utils.h"
-- 
2.4.3



More information about the Spice-devel mailing list