[PATCH] ivi-controller: do refactor send_surface_add_event

Natsume, Wataru (ADITJ/SWG) wnatsume at jp.adit-jv.com
Tue May 31 07:32:09 EDT 2016


Check logic should be improved because ivilayer is never null.

Signed-off-by: Wataru Natsume <wataru_natsume at xddp.denso.co.jp>
---
 weston-ivi-shell/src/ivi-controller-impl.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c
index af79ded..b5087fc 100644
--- a/weston-ivi-shell/src/ivi-controller-impl.c
+++ b/weston-ivi-shell/src/ivi-controller-impl.c
@@ -164,26 +164,24 @@ send_surface_add_event(struct ivisurface *ivisurf,
     else if (mask & IVI_NOTIFICATION_ADD) {
         for (i = 0; i < (int)length; i++) {
             /* Send new surface event */
-            ivilayer = NULL;
             if (wl_list_empty(&shell->list_layer)) {
                 break;
             }
 
+            int found = 0;
             wl_list_for_each(ivilayer, &shell->list_layer, link) {
                 if (ivilayer->layout_layer == pArray[i]) {
-                    break;
+                    found = 1;
+                    break;
                 }
             }
 
-            if (ivilayer == NULL) {
-                continue;
-            }
-
-            layer_resource = wl_resource_find_for_client(&ivilayer->resource_list,
-                                                         client);
-
-            if (layer_resource != NULL) {
-                ivi_controller_surface_send_layer(resource, layer_resource);
+            if (found == 1) {
+                layer_resource = wl_resource_find_for_client(&ivilayer->resource_list,
+                                                             client);
+                if (layer_resource != NULL) {
+                    ivi_controller_surface_send_layer(resource, layer_resource);
+                }
             }
         }
     }
-- 
1.7.9.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ivi-controller-do-refactor-send_surface_add_event.patch
Type: application/octet-stream
Size: 2066 bytes
Desc: 0001-ivi-controller-do-refactor-send_surface_add_event.patch
URL: <http://lists.genivi.org/pipermail/genivi-ivi-layer-management_lists.genivi.org/attachments/20160531/e7be844a/attachment.patch>


More information about the genivi-ivi-layer-management mailing list