[PATCH v2] ivi-controller: do refactor send_surface_add_event

Natsume, Wataru (ADITJ/SWG) wnatsume at jp.adit-jv.com
Thu Jun 16 08:22:55 EDT 2016


Check logic should be improved because ivilayer is never null.

Signed-off-by: Wataru Natsume <wataru_natsume at xddp.denso.co.jp>
---
Changes from v1 - Logic optimized through review

 weston-ivi-shell/src/ivi-controller-impl.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c
index af79ded..a8242f6 100644
--- a/weston-ivi-shell/src/ivi-controller-impl.c
+++ b/weston-ivi-shell/src/ivi-controller-impl.c
@@ -164,27 +164,22 @@ 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;
             }
 
             wl_list_for_each(ivilayer, &shell->list_layer, link) {
                 if (ivilayer->layout_layer == pArray[i]) {
+                    layer_resource =
+                        wl_resource_find_for_client(&ivilayer->resource_list,
+                                                    client);
+                    if (layer_resource != NULL) {
+                        ivi_controller_surface_send_layer(resource, layer_resource);
+                    }
+
                     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);
-            }
         }
     }
 
-- 
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: 2035 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/20160616/14a3005f/attachment.patch>


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