[Spice-devel] [PATCH 2/3] Move C template files to their own directory

Christophe Fergeau cfergeau at redhat.com
Tue May 13 05:51:36 PDT 2014


spice-common ships a few C files which are not meant to be compiled
directly, but which are used as templates: various specialized
implementations will be generated depending on #define constants.

This commit moves them to a separate directory in order to make it clear
that they are not to be compiled directly.
---
 common/Makefile.am                          | 27 ++++++++++----------
 common/lz.c                                 | 38 ++++++++++++++---------------
 common/quic.c                               | 18 +++++++-------
 common/{ => templates}/canvas_base.c        | 24 +++++++++---------
 common/{ => templates}/canvas_base.h        |  8 +++---
 common/{ => templates}/gdi_canvas.c         |  0
 common/{ => templates}/gdi_canvas.h         |  6 ++---
 common/{ => templates}/gl_canvas.c          |  0
 common/{ => templates}/gl_canvas.h          |  6 ++---
 common/{ => templates}/lz_compress_tmpl.c   |  0
 common/{ => templates}/lz_decompress_tmpl.c |  0
 common/{ => templates}/quic_family_tmpl.c   |  0
 common/{ => templates}/quic_rgb_tmpl.c      |  0
 common/{ => templates}/quic_tmpl.c          |  0
 common/{ => templates}/sw_canvas.c          | 10 ++++----
 common/{ => templates}/sw_canvas.h          |  8 +++---
 16 files changed, 72 insertions(+), 73 deletions(-)
 rename common/{ => templates}/canvas_base.c (99%)
 rename common/{ => templates}/canvas_base.h (99%)
 rename common/{ => templates}/gdi_canvas.c (100%)
 rename common/{ => templates}/gdi_canvas.h (93%)
 rename common/{ => templates}/gl_canvas.c (100%)
 rename common/{ => templates}/gl_canvas.h (94%)
 rename common/{ => templates}/lz_compress_tmpl.c (100%)
 rename common/{ => templates}/lz_decompress_tmpl.c (100%)
 rename common/{ => templates}/quic_family_tmpl.c (100%)
 rename common/{ => templates}/quic_rgb_tmpl.c (100%)
 rename common/{ => templates}/quic_tmpl.c (100%)
 rename common/{ => templates}/sw_canvas.c (99%)
 rename common/{ => templates}/sw_canvas.h (94%)

diff --git a/common/Makefile.am b/common/Makefile.am
index 435d448..9277660 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -140,20 +140,19 @@ $(top_srcdir)/spice-protocol/spice/enums.h: $(top_srcdir)/spice.proto # $(MARSHA
 EXTRA_DIST =				\
 	$(CLIENT_MARSHALLERS)		\
 	$(SERVER_MARSHALLERS)		\
-	canvas_base.c			\
-	canvas_base.h			\
-	gdi_canvas.c			\
-	gdi_canvas.h			\
-	gl_canvas.c			\
-	gl_canvas.h			\
-	lz_compress_tmpl.c		\
-	lz_decompress_tmpl.c		\
-	quic_family_tmpl.c		\
-	quic_rgb_tmpl.c			\
-	quic_tmpl.c			\
-	snd_codec.h			\
-	sw_canvas.c			\
-	sw_canvas.h			\
+	templates/canvas_base.c			\
+	templates/canvas_base.h			\
+	templates/gdi_canvas.c			\
+	templates/gdi_canvas.h			\
+	templates/gl_canvas.c			\
+	templates/gl_canvas.h			\
+	templates/sw_canvas.c			\
+	templates/sw_canvas.h			\
+	templates/lz_compress_tmpl.c		\
+	templates/lz_decompress_tmpl.c		\
+	templates/quic_family_tmpl.c		\
+	templates/quic_rgb_tmpl.c			\
+	templates/quic_tmpl.c			\
 	$(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/common/lz.c b/common/lz.c
index d1c4033..9b78d57 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -436,66 +436,66 @@ typedef uint16_t rgb16_pixel_t;
 
 
 #define LZ_PLT
-#include "lz_compress_tmpl.c"
+#include "templates/lz_compress_tmpl.c"
 #define LZ_PLT
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_PLT
 #define PLT8
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_PLT
 #define PLT4_BE
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_PLT
 #define PLT4_LE
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_PLT
 #define PLT1_BE
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_PLT
 #define PLT1_LE
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_A8
-#include "lz_compress_tmpl.c"
+#include "templates/lz_compress_tmpl.c"
 #define LZ_A8
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 #define LZ_A8
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_RGB16
-#include "lz_compress_tmpl.c"
+#include "templates/lz_compress_tmpl.c"
 #define LZ_RGB16
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 #define LZ_RGB16
 #define TO_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_RGB24
-#include "lz_compress_tmpl.c"
+#include "templates/lz_compress_tmpl.c"
 #define LZ_RGB24
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 
 #define LZ_RGB32
-#include "lz_compress_tmpl.c"
+#include "templates/lz_compress_tmpl.c"
 #define LZ_RGB32
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #define LZ_RGB_ALPHA
-#include "lz_compress_tmpl.c"
+#include "templates/lz_compress_tmpl.c"
 #define LZ_RGB_ALPHA
-#include "lz_decompress_tmpl.c"
+#include "templates/lz_decompress_tmpl.c"
 
 #undef LZ_UNEXPECT_CONDITIONAL
 #undef LZ_EXPECT_CONDITIONAL
diff --git a/common/quic.c b/common/quic.c
index c10e3c4..42c711b 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -323,11 +323,11 @@ static unsigned int cnt_l_zeroes(const unsigned int bits)
 }
 
 #define QUIC_FAMILY_8BPC
-#include "quic_family_tmpl.c"
+#include "templates/quic_family_tmpl.c"
 
 #ifdef QUIC_RGB
 #define QUIC_FAMILY_5BPC
-#include "quic_family_tmpl.c"
+#include "templates/quic_family_tmpl.c"
 #endif
 
 static void decorelate_init(QuicFamily *family, int bpc)
@@ -814,29 +814,29 @@ typedef uint16_t rgb16_pixel_t;
 #undef ATTR_PACKED
 
 #define ONE_BYTE
-#include "quic_tmpl.c"
+#include "templates/quic_tmpl.c"
 
 #define FOUR_BYTE
-#include "quic_tmpl.c"
+#include "templates/quic_tmpl.c"
 
 #ifdef QUIC_RGB
 
 #define QUIC_RGB32
-#include "quic_rgb_tmpl.c"
+#include "templates/quic_rgb_tmpl.c"
 
 #define QUIC_RGB24
-#include "quic_rgb_tmpl.c"
+#include "templates/quic_rgb_tmpl.c"
 
 #define QUIC_RGB16
-#include "quic_rgb_tmpl.c"
+#include "templates/quic_rgb_tmpl.c"
 
 #define QUIC_RGB16_TO_32
-#include "quic_rgb_tmpl.c"
+#include "templates/quic_rgb_tmpl.c"
 
 #else
 
 #define THREE_BYTE
-#include "quic_tmpl.c"
+#include "templates/quic_tmpl.c"
 
 #endif
 
diff --git a/common/canvas_base.c b/common/templates/canvas_base.c
similarity index 99%
rename from common/canvas_base.c
rename to common/templates/canvas_base.c
index 2753fae..c07ecad 100644
--- a/common/canvas_base.c
+++ b/common/templates/canvas_base.c
@@ -27,18 +27,18 @@
 #include <math.h>
 
 #include <spice/macros.h>
-#include "log.h"
-#include "quic.h"
-#include "lz.h"
-#include "canvas_base.h"
-#include "pixman_utils.h"
-#include "canvas_utils.h"
-#include "rect.h"
-#include "lines.h"
-#include "rop3.h"
-#include "mem.h"
-#include "macros.h"
-#include "mutex.h"
+#include "common/log.h"
+#include "common/quic.h"
+#include "common/lz.h"
+#include "common/templates/canvas_base.h"
+#include "common/pixman_utils.h"
+#include "common/canvas_utils.h"
+#include "common/rect.h"
+#include "common/lines.h"
+#include "common/rop3.h"
+#include "common/mem.h"
+#include "common/macros.h"
+#include "common/mutex.h"
 
 #define ROUND(_x) ((int)floor((_x) + 0.5))
 
diff --git a/common/canvas_base.h b/common/templates/canvas_base.h
similarity index 99%
rename from common/canvas_base.h
rename to common/templates/canvas_base.h
index 637cdc1..63e0fa6 100644
--- a/common/canvas_base.h
+++ b/common/templates/canvas_base.h
@@ -21,10 +21,10 @@
 
 #include <spice/macros.h>
 
-#include "pixman_utils.h"
-#include "lz.h"
-#include "region.h"
-#include "draw.h"
+#include "common/pixman_utils.h"
+#include "common/lz.h"
+#include "common/region.h"
+#include "common/draw.h"
 #ifdef WIN32
 #include <windows.h>
 #endif
diff --git a/common/gdi_canvas.c b/common/templates/gdi_canvas.c
similarity index 100%
rename from common/gdi_canvas.c
rename to common/templates/gdi_canvas.c
diff --git a/common/gdi_canvas.h b/common/templates/gdi_canvas.h
similarity index 93%
rename from common/gdi_canvas.h
rename to common/templates/gdi_canvas.h
index dc302dc..42a5ab0 100644
--- a/common/gdi_canvas.h
+++ b/common/templates/gdi_canvas.h
@@ -22,9 +22,9 @@
 #include <stdint.h>
 #include <spice/macros.h>
 
-#include "pixman_utils.h"
-#include "canvas_base.h"
-#include "region.h"
+#include "common/pixman_utils.h"
+#include "common/templates/canvas_base.h"
+#include "common/region.h"
 
 SPICE_BEGIN_DECLS
 
diff --git a/common/gl_canvas.c b/common/templates/gl_canvas.c
similarity index 100%
rename from common/gl_canvas.c
rename to common/templates/gl_canvas.c
diff --git a/common/gl_canvas.h b/common/templates/gl_canvas.h
similarity index 94%
rename from common/gl_canvas.h
rename to common/templates/gl_canvas.h
index 33b9fad..e880c65 100644
--- a/common/gl_canvas.h
+++ b/common/templates/gl_canvas.h
@@ -21,9 +21,9 @@
 
 #include <spice/macros.h>
 
-#include "glc.h"
-#include "canvas_base.h"
-#include "region.h"
+#include "common/glc.h"
+#include "common/templates/canvas_base.h"
+#include "common/region.h"
 
 SPICE_BEGIN_DECLS
 
diff --git a/common/lz_compress_tmpl.c b/common/templates/lz_compress_tmpl.c
similarity index 100%
rename from common/lz_compress_tmpl.c
rename to common/templates/lz_compress_tmpl.c
diff --git a/common/lz_decompress_tmpl.c b/common/templates/lz_decompress_tmpl.c
similarity index 100%
rename from common/lz_decompress_tmpl.c
rename to common/templates/lz_decompress_tmpl.c
diff --git a/common/quic_family_tmpl.c b/common/templates/quic_family_tmpl.c
similarity index 100%
rename from common/quic_family_tmpl.c
rename to common/templates/quic_family_tmpl.c
diff --git a/common/quic_rgb_tmpl.c b/common/templates/quic_rgb_tmpl.c
similarity index 100%
rename from common/quic_rgb_tmpl.c
rename to common/templates/quic_rgb_tmpl.c
diff --git a/common/quic_tmpl.c b/common/templates/quic_tmpl.c
similarity index 100%
rename from common/quic_tmpl.c
rename to common/templates/quic_tmpl.c
diff --git a/common/sw_canvas.c b/common/templates/sw_canvas.c
similarity index 99%
rename from common/sw_canvas.c
rename to common/templates/sw_canvas.c
index f947dde..3778d89 100644
--- a/common/sw_canvas.c
+++ b/common/templates/sw_canvas.c
@@ -23,13 +23,13 @@
 #endif
 
 #include <math.h>
-#include "sw_canvas.h"
+#include "common/templates/sw_canvas.h"
 #define CANVAS_USE_PIXMAN
 #define CANVAS_SINGLE_INSTANCE
-#include "canvas_base.c"
-#include "rect.h"
-#include "region.h"
-#include "pixman_utils.h"
+#include "common/templates/canvas_base.c"
+#include "common/rect.h"
+#include "common/region.h"
+#include "common/pixman_utils.h"
 
 typedef struct SwCanvas SwCanvas;
 
diff --git a/common/sw_canvas.h b/common/templates/sw_canvas.h
similarity index 94%
rename from common/sw_canvas.h
rename to common/templates/sw_canvas.h
index eb6c1f8..1b15778 100644
--- a/common/sw_canvas.h
+++ b/common/templates/sw_canvas.h
@@ -22,10 +22,10 @@
 #include <stdint.h>
 #include <spice/macros.h>
 
-#include "draw.h"
-#include "pixman_utils.h"
-#include "canvas_base.h"
-#include "region.h"
+#include "common/draw.h"
+#include "common/pixman_utils.h"
+#include "common/templates/canvas_base.h"
+#include "common/region.h"
 
 SPICE_BEGIN_DECLS
 
-- 
1.9.0



More information about the Spice-devel mailing list