summaryrefslogtreecommitdiff
path: root/weston-ivi-shell
diff options
context:
space:
mode:
authorNobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>2015-08-26 10:08:50 +0900
committerNobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>2015-08-27 13:52:26 +0900
commit1480d7ec40fbeff3e8d81eaf221ee8cf5e51d7e2 (patch)
tree6dd83a70f4461ce8247ce59f12175cf0ea7481a4 /weston-ivi-shell
parent779b8975badd1f07ff63da55ee8da10839994538 (diff)
downloadwayland-ivi-extension-1480d7ec40fbeff3e8d81eaf221ee8cf5e51d7e2.tar.gz
ivi-controller: remove redundant wl_list_empty/init calls
Checking wl_list_empty() on a link offers no information: if it returns true, wl_list_remove() is safe to do. If it returns false, you still do not know if wl_list_remove() is safe; the link could be part of a list, or the link could be "uninitialized" (e.g. just wl_list_remove()'d). (From Pekka Paalanen's comment at http://lists.freedesktop.org/archives/wayland-devel/2015-August/023987.html). Calling wl_list_init just before wl_list_insert is redundant. Because the links of the list are not read before it is overwritten by wl_list_insert. Signed-off-by: Emre Ucan <eucan@de.adit-jv.com> Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
Diffstat (limited to 'weston-ivi-shell')
-rw-r--r--weston-ivi-shell/src/ivi-controller-impl.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/weston-ivi-shell/src/ivi-controller-impl.c b/weston-ivi-shell/src/ivi-controller-impl.c
index 1f0ae95..1fb4de0 100644
--- a/weston-ivi-shell/src/ivi-controller-impl.c
+++ b/weston-ivi-shell/src/ivi-controller-impl.c
@@ -138,10 +138,7 @@ destroy_ivicontroller_surface(struct wl_resource *resource)
continue;
}
- if (!wl_list_empty(&ctrlsurf->link)) {
- wl_list_remove(&ctrlsurf->link);
- }
-
+ wl_list_remove(&ctrlsurf->link);
is_removed = 1;
free(ctrlsurf);
ctrlsurf = NULL;
@@ -297,7 +294,6 @@ controller_screen_create(struct ivishell *shell,
&controller_screen_implementation,
iviscrn, destroy_ivicontroller_screen);
- wl_list_init(&ctrlscrn->link);
wl_list_insert(&shell->list_controller_screen, &ctrlscrn->link);
return ctrlscrn;
@@ -466,7 +462,6 @@ update_surface_prop(struct ivisurface *ivisurf,
if (NULL == link_layer) {
continue;
}
- wl_list_init(&link_layer->link);
link_layer->layer = NULL;
wl_list_for_each(ivilayer, &shell->list_layer, link) {
if (ivilayer->layout_layer == pArray[i]) {
@@ -641,7 +636,6 @@ update_layer_prop(struct ivilayer *ivilayer,
if (NULL == link_scrn) {
continue;
}
- wl_list_init(&link_scrn->link);
link_scrn->screen = NULL;
wl_list_for_each(iviscrn, &shell->list_screen, link) {
if (iviscrn->layout_screen == pArray[i]) {
@@ -1251,7 +1245,6 @@ controller_layer_create(struct wl_client *client,
return;
}
- wl_list_init(&ctrllayer->link);
wl_list_insert(&shell->list_controller_layer, &ctrllayer->link);
wl_resource_set_implementation(ctrllayer->resource,
@@ -1299,7 +1292,6 @@ controller_surface_create(struct wl_client *client,
ctrlsurf->client = client;
ctrlsurf->id = id;
ctrlsurf->id_surface = id_surface;
- wl_list_init(&ctrlsurf->link);
wl_list_insert(&shell->list_controller_surface, &ctrlsurf->link);
ctrlsurf->resource = wl_resource_create(client,
@@ -1412,7 +1404,6 @@ bind_ivi_controller(struct wl_client *client, void *data,
controller->client = client;
controller->id = id;
- wl_list_init(&controller->link);
wl_list_insert(&shell->list_controller, &controller->link);
add_client_to_resources(shell, client, controller);
@@ -1461,7 +1452,6 @@ create_layer(struct ivishell *shell,
ivilayer->shell = shell;
wl_list_init(&ivilayer->list_screen);
- wl_list_init(&ivilayer->link);
wl_list_insert(&shell->list_layer, &ivilayer->link);
ivilayer->layout_layer = layout_layer;
@@ -1497,7 +1487,6 @@ create_surface(struct ivishell *shell,
ivisurf->shell = shell;
ivisurf->layout_surface = layout_surface;
wl_list_init(&ivisurf->list_layer);
- wl_list_init(&ivisurf->link);
wl_list_insert(&shell->list_surface, &ivisurf->link);
wl_list_for_each(controller, &shell->list_controller, link) {