[Spice-devel] [PATCH 1/4] server: remove hardcoded RED_MAX_RENDERERS

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


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

---
 server/red_dispatcher.c | 4 ++--
 server/red_worker.c     | 2 +-
 server/red_worker.h     | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 113848a..6d7756c 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -219,7 +219,7 @@ static RendererInfo renderers_info[] = {
     {RED_RENDERER_INVALID, NULL},
 };
 
-static uint32_t renderers[RED_MAX_RENDERERS];
+static uint32_t renderers[RED_RENDERER_LAST];
 static uint32_t num_renderers = 0;
 
 static RendererInfo *find_renderer(const char *name)
@@ -238,7 +238,7 @@ int red_dispatcher_add_renderer(const char *name)
 {
     RendererInfo *inf;
 
-    if (num_renderers == RED_MAX_RENDERERS || !(inf = find_renderer(name))) {
+    if (num_renderers == RED_RENDERER_LAST || !(inf = find_renderer(name))) {
         return FALSE;
     }
     renderers[num_renderers++] = inf->id;
diff --git a/server/red_worker.c b/server/red_worker.c
index 6f14b70..d25feb0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -944,7 +944,7 @@ typedef struct RedWorker {
     uint32_t repoll_cmd_ring;
     uint32_t repoll_cursor_ring;
     uint32_t num_renderers;
-    uint32_t renderers[RED_MAX_RENDERERS];
+    uint32_t renderers[RED_RENDERER_LAST];
     uint32_t renderer;
 
     RedSurface surfaces[NUM_SURFACES];
diff --git a/server/red_worker.h b/server/red_worker.h
index c34369a..ca8aadb 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -75,13 +75,13 @@ enum {
 
 typedef uint32_t RedWorkerMessage;
 
-#define RED_MAX_RENDERERS 4
-
 enum {
     RED_RENDERER_INVALID,
     RED_RENDERER_SW,
     RED_RENDERER_OGL_PBUF,
     RED_RENDERER_OGL_PIXMAP,
+
+    RED_RENDERER_LAST
 };
 
 typedef struct RedDispatcher RedDispatcher;
@@ -91,7 +91,7 @@ typedef struct WorkerInitData {
     int id;
     uint32_t *pending;
     uint32_t num_renderers;
-    uint32_t renderers[RED_MAX_RENDERERS];
+    uint32_t renderers[RED_RENDERER_LAST];
     SpiceImageCompression image_compression;
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;
-- 
2.4.3



More information about the Spice-devel mailing list