[Spice-devel] [PATCH 06/15] worker: minor simplifcation

Frediano Ziglio fziglio at redhat.com
Tue Nov 3 02:20:14 PST 2015


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

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

diff --git a/server/red_worker.c b/server/red_worker.c
index 491e55e..fbcab6d 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1506,16 +1506,18 @@ static inline Shadow *__find_shadow(TreeItem *item)
     return ((DrawItem *)item)->shadow;
 }
 
-static inline Ring *ring_of(RedWorker *worker, Ring *ring, TreeItem *item)
+/* FIXME: weird function: return container ring, or ring... */
+static inline Ring *ring_of(Ring *ring, TreeItem *item)
 {
     return (item->container) ? &item->container->items : ring;
 }
 
-static inline int __contained_by(RedWorker *worker, TreeItem *item, Ring *ring)
+/* FIXME: weird function: true if item has some parent container == ring, or has no immediate container*/
+static inline int __contained_by(TreeItem *item, Ring *ring)
 {
     spice_assert(item && ring);
     do {
-        Ring *now = ring_of(worker, ring, item);
+        Ring *now = ring_of(ring, item);
         if (now == ring) {
             return TRUE;
         }
@@ -1557,8 +1559,8 @@ static inline void __exclude_region(RedWorker *worker, Ring *ring, TreeItem *ite
                     region_exclude(&shadow->on_hold, &and_rgn);
                     region_or(rgn, &and_rgn);
                     // in flat representation of current, shadow is always his owner next
-                    if (!__contained_by(worker, (TreeItem*)shadow, *top_ring)) {
-                        *top_ring = ring_of(worker, ring, (TreeItem*)shadow);
+                    if (!__contained_by((TreeItem*)shadow, *top_ring)) {
+                        *top_ring = ring_of(ring, (TreeItem*)shadow);
                     }
                 }
             } else {
@@ -1577,8 +1579,8 @@ static inline void __exclude_region(RedWorker *worker, Ring *ring, TreeItem *ite
                 region_exclude(rgn, &and_rgn);
                 if ((shadow = __find_shadow(item))) {
                     region_or(rgn, &shadow->on_hold);
-                    if (!__contained_by(worker, (TreeItem*)shadow, *top_ring)) {
-                        *top_ring = ring_of(worker, ring, (TreeItem*)shadow);
+                    if (!__contained_by((TreeItem*)shadow, *top_ring)) {
+                        *top_ring = ring_of(ring, (TreeItem*)shadow);
                     }
                 }
             }
-- 
2.4.3



More information about the Spice-devel mailing list