[Spice-devel] [PATCH 2/2] server/red_worker: remove __validate_surface

Alon Levy alevy at redhat.com
Thu Aug 29 06:23:05 PDT 2013


There is only one user. Add a check for surface_id > 0 in
red_process_surface (the sole user) since primaries (surface_id = 0) may
not be sent as surfaces.
---
 server/red_worker.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index fc7463d..f931b66 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1244,11 +1244,6 @@ static inline int is_primary_surface(RedWorker *worker, uint32_t surface_id)
     return FALSE;
 }
 
-static inline void __validate_surface(RedWorker *worker, uint32_t surface_id)
-{
-    spice_warn_if(surface_id >= worker->n_surfaces);
-}
-
 static inline int validate_surface(RedWorker *worker, uint32_t surface_id)
 {
     spice_warn_if(surface_id >= worker->n_surfaces);
@@ -4219,7 +4214,8 @@ static inline void red_process_surface(RedWorker *worker, RedSurfaceCmd *surface
     uint8_t *data;
 
     surface_id = surface->surface_id;
-    __validate_surface(worker, surface_id);
+    spice_return_if_fail(surface_id < worker->n_surfaces);
+    spice_return_if_fail(surface_id >= 1);
 
     red_surface = &worker->surfaces[surface_id];
 
-- 
1.8.3.1



More information about the Spice-devel mailing list