[PATCH v2] ivi-controller: do refactor send_layer_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 iviscrn is never null.
Besides, do not iterate over empty list like send_surface_add_event.

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 |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c
index a8242f6..490f4c1 100644
--- a/weston-ivi-shell/src/ivi-controller-impl.c
+++ b/weston-ivi-shell/src/ivi-controller-impl.c
@@ -292,23 +292,22 @@ send_layer_add_event(struct ivilayer *ivilayer,
     else if (mask & IVI_NOTIFICATION_ADD) {
         for (i = 0; i < (int)length; i++) {
             /* Send new layer event */
-            iviscrn = NULL;
+            if (wl_list_empty(&shell->list_screen)){
+                break;
+            }
+
             wl_list_for_each(iviscrn, &shell->list_screen, link) {
                 if (iviscrn->layout_screen == pArray[i]) {
+                    resource_output =
+                        wl_resource_find_for_client(&iviscrn->output->resource_list,
+                                                    client);
+                    if (resource_output != NULL) {
+                        ivi_controller_layer_send_screen(resource, resource_output);
+                    }
+
                     break;
                 }
             }
-
-            if (iviscrn == NULL) {
-                continue;
-            }
-
-            resource_output =
-                wl_resource_find_for_client(&iviscrn->output->resource_list,
-                                     client);
-            if (resource_output != NULL) {
-                ivi_controller_layer_send_screen(resource, resource_output);
-            }
         }
     }
 
-- 
1.7.9.5

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


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