From eeed0086eda16bdf4974392a80d9243defcc9831 Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Wed, 28 Sep 2016 18:23:05 -0300 Subject: elementary: refactor elm_atspi_bridge function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to avoid the following build warning: lib/elementary/elm_atspi_bridge.c: In function ‘_children_changed_signal_send’: lib/elementary/elm_atspi_bridge.c:3971:4: warning: ‘idx’ may be used uninitialized in this function [-Wmaybe-uninitialized] _bridge_signal_send(data, event->object, ATSPI_DBUS_INTERFACE_EVENT_OBJECT A little refactoring was done to function _children_changed_signal_send. Actually I wasn't able to see a codepath to use idx unintialized, but this way is more clear and avoid compiler possible confusion. --- src/lib/elementary/elm_atspi_bridge.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/lib/elementary/elm_atspi_bridge.c b/src/lib/elementary/elm_atspi_bridge.c index 011570ccad..51b259c3dd 100644 --- a/src/lib/elementary/elm_atspi_bridge.c +++ b/src/lib/elementary/elm_atspi_bridge.c @@ -3948,7 +3948,16 @@ _children_changed_signal_send(void *data, const Efl_Event *event) ELM_ATSPI_BRIDGE_DATA_GET_OR_RETURN(data, pd); - type = ev_data->is_added ? ATSPI_OBJECT_CHILD_ADDED : ATSPI_OBJECT_CHILD_REMOVED; + if (ev_data->is_added) + { + type = ATSPI_OBJECT_CHILD_ADDED; + atspi_desc = "add"; + } + else + { + type = ATSPI_OBJECT_CHILD_REMOVED; + atspi_desc = "remove"; + } if (!STATE_TYPE_GET(pd->object_children_broadcast_mask, type)) { @@ -3956,18 +3965,7 @@ _children_changed_signal_send(void *data, const Efl_Event *event) return; } - switch (type) - { - case ATSPI_OBJECT_CHILD_ADDED: - atspi_desc = "add"; - idx = elm_interface_atspi_accessible_index_in_parent_get(ev_data->child); - break; - case ATSPI_OBJECT_CHILD_REMOVED: - atspi_desc = "remove"; - idx = elm_interface_atspi_accessible_index_in_parent_get(ev_data->child); - break; - } - + idx = elm_interface_atspi_accessible_index_in_parent_get(ev_data->child); _bridge_signal_send(data, event->object, ATSPI_DBUS_INTERFACE_EVENT_OBJECT, &_event_obj_signals[ATSPI_OBJECT_EVENT_CHILDREN_CHANGED], atspi_desc, idx, 0, "(so)", eldbus_connection_unique_name_get(pd->a11y_bus), ev_data->child); -- cgit v1.2.1