focus_server: Apply new macro 34/133734/4 accepted/tizen/unified/20170627.071447 accepted/tizen/unified/20170630.083020 submit/tizen/20170615.073353 submit/tizen/20170626.070954
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 13 Jun 2017 08:08:21 +0000 (17:08 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 15 Jun 2017 01:48:13 +0000 (10:48 +0900)
  CONTINUE_IF_LIST_DATA_IS_NULL(x_node, x_list)
  CONTINUE_IF_NOT_MY_FOCUS_NODE(x_node, x_param)

[Version] 0.11.8
[Profile] Common
[Issue Type] Refactoring

Change-Id: I191793ab7fb8b9eebd359b365458f349494a89bf
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
focus_server/mm_sound_mgr_focus.c
packaging/libmm-sound.spec

index 95e385b..11e577e 100644 (file)
@@ -74,8 +74,14 @@ typedef struct {
        x_node->taken_##x_postfix[i].by_session = x_by_session; \
 } while (0)
 
-#define CHECK_MY_NODE(x_node, x_param) \
-       (x_node && !x_node->is_for_watch && (x_node->pid == x_param->pid) && (x_node->handle_id == x_param->handle_id) && (x_node->is_for_session == x_param->is_for_session))
+#define CONTINUE_IF_LIST_DATA_IS_NULL(x_node, x_list) \
+       if (!((x_node) = (focus_node_t *)(x_list)->data)) \
+               continue; \
+
+#define CONTINUE_IF_NOT_MY_FOCUS_NODE(x_node, x_param) \
+       if ((x_node)->is_for_watch || ((x_node)->pid != (x_param)->pid) || ((x_node)->handle_id != (x_param)->handle_id) || \
+           ((x_node)->is_for_session != (x_param)->is_for_session)) \
+               continue; \
 
 static char* __get_focus_pipe_path(int instance_id, int handle, const char* postfix, bool is_watch)
 {
@@ -350,8 +356,7 @@ static int _mm_sound_mgr_focus_do_monitor_callback_outer(focus_type_e focus_type
        }
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if (node == my_node)
                        continue;
                if (!node->is_for_watch || !node->is_for_monitor || !node->is_for_session)
@@ -383,8 +388,7 @@ static int _mm_sound_mgr_focus_do_monitor_callback(focus_type_e focus_type, focu
        }
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if (!node->is_for_watch || !node->is_for_monitor || !node->is_for_session)
                        continue;
                if (node == my_node || !(node->pid == my_node->pid && my_node->is_for_session))
@@ -416,8 +420,7 @@ static int _mm_sound_mgr_focus_do_watch_callback(focus_type_e focus_type, focus_
        }
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if (node == my_node || (node->pid == my_node->pid && node->is_for_session && my_node->is_for_session))
                        continue;
                if (!node->is_for_watch || !(node->status & focus_type))
@@ -616,8 +619,7 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
                        if (reacquisition_changed) {
                                if (!victim_node->reacquisition) {
                                        for (list = g_focus_node_list; list != NULL; list = list->next) {
-                                               if (!(node = (focus_node_t *)list->data))
-                                                       continue;
+                                               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                                                if (node->taken_by_id[i].pid == victim_node->pid) {
                                                        UPDATE_FOCUS_TAKEN_INFO(backup, node, node->taken_by_id[i].pid, node->taken_by_id[i].handle_id, node->taken_by_id[i].by_session);
                                                        UPDATE_FOCUS_TAKEN_INFO(by_id, node, taken_pid, taken_hid, taken_by_session);
@@ -628,8 +630,7 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
                                        }
                                } else {
                                        for (list = g_focus_node_list; list != NULL; list = list->next) {
-                                               if (!(node = (focus_node_t *)list->data))
-                                                       continue;
+                                               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                                                if (node->taken_backup[i].pid == victim_node->pid) {
                                                        UPDATE_FOCUS_TAKEN_INFO(by_id, node, node->taken_backup[i].pid, node->taken_backup[i].handle_id, node->taken_backup[i].by_session);
                                                        UPDATE_FOCUS_TAKEN_INFO(backup, node, 0, 0, false);
@@ -741,12 +742,12 @@ int mm_sound_mgr_focus_create_node(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               node = (focus_node_t *)list->data;
-               if (CHECK_MY_NODE(node, param)) {
-                       debug_error("the node of pid[%d]/handle_id[%d] is already created\n", param->pid, param->handle_id);
-                       ret = MM_ERROR_INVALID_ARGUMENT;
-                       goto FINISH;
-               }
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
+               CONTINUE_IF_NOT_MY_FOCUS_NODE(node, param);
+
+               debug_error("the node of pid[%d]/handle_id[%d] is already created\n", param->pid, param->handle_id);
+               ret = MM_ERROR_INVALID_ARGUMENT;
+               goto FINISH;
        }
 
        /* get priority from stream type */
@@ -797,12 +798,12 @@ int mm_sound_mgr_focus_destroy_node(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               node = (focus_node_t *)list->data;
-               if (CHECK_MY_NODE(node, param)) {
-                       debug_log("found the node of pid[%d]/handle_id[%d]\n", param->pid, param->handle_id);
-                       my_node = node;
-                       break;
-               }
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
+               CONTINUE_IF_NOT_MY_FOCUS_NODE(node, param);
+
+               debug_log("found the node of pid[%d]/handle_id[%d]\n", param->pid, param->handle_id);
+               my_node = node;
+               break;
        }
        if (my_node == NULL) {
                debug_error("could not find any node of pid[%d]/handle_id[%d]/is_for_session[%d]\n", param->pid, param->handle_id, param->is_for_session);
@@ -813,8 +814,7 @@ int mm_sound_mgr_focus_destroy_node(const _mm_sound_mgr_focus_param_t *param)
        /* Check if there's remaining focus for session for the same PID of incomming param */
        if (my_node->is_for_session) {
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        if (my_node == node || node->is_for_watch)
                                continue;
                        if (node->pid == my_node->pid && node->is_for_session && node->status) {
@@ -842,30 +842,30 @@ int mm_sound_mgr_focus_destroy_node(const _mm_sound_mgr_focus_param_t *param)
                MMSOUND_STRNCPY(new_param->ext_info, my_node->ext_info[i], MM_SOUND_NAME_NUM);
 
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        if (my_node == node || node->is_for_watch)
                                continue;
                        for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
-                               if (node->taken_by_id[i].pid == param->pid) {
-                                       if (my_node->taken_by_id[i].pid) {
-                                       /* If exists update the taken focus info to my victim node */
-                                               if (node->taken_by_id[i].by_session && !node->status) {
-                                                       UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, my_node->taken_by_id[i].by_session);
-                                               } else if (node->taken_by_id[i].handle_id == param->handle_id) {
-                                                       UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, false);
-                                               }
-                                       } else if (my_node->status & (i+1)) {
-                                               if (node->is_for_session)
-                                                       continue;
-                                               if (node->taken_by_id[i].handle_id == new_param->handle_id || node->taken_by_id[i].by_session) {
-                                                       /* do callback for resumption */
-                                                       if ((ret = _mm_sound_mgr_focus_do_callback(FOCUS_COMMAND_ACQUIRE, node, new_param)))
-                                                               debug_error("Fail to _focus_do_callback for COMMAND ACQUIRE to node[%x], ret[0x%x]\n", node, ret);
-                                                       if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN)) {
-                                                               need_to_trigger_watch_cb = false;
-                                                               my_node->status &= ~(new_param->request_type);
-                                                       }
+                               if (node->taken_by_id[i].pid != param->pid)
+                                       continue;
+
+                               if (my_node->taken_by_id[i].pid) {
+                               /* If exists update the taken focus info to my victim node */
+                                       if (node->taken_by_id[i].by_session && !node->status) {
+                                               UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, my_node->taken_by_id[i].by_session);
+                                       } else if (node->taken_by_id[i].handle_id == param->handle_id) {
+                                               UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, false);
+                                       }
+                               } else if (my_node->status & (i+1)) {
+                                       if (node->is_for_session)
+                                               continue;
+                                       if (node->taken_by_id[i].handle_id == new_param->handle_id || node->taken_by_id[i].by_session) {
+                                               /* do callback for resumption */
+                                               if ((ret = _mm_sound_mgr_focus_do_callback(FOCUS_COMMAND_ACQUIRE, node, new_param)))
+                                                       debug_error("Fail to _focus_do_callback for COMMAND ACQUIRE to node[%x], ret[0x%x]\n", node, ret);
+                                               if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN)) {
+                                                       need_to_trigger_watch_cb = false;
+                                                       my_node->status &= ~(new_param->request_type);
                                                }
                                        }
                                }
@@ -907,17 +907,17 @@ int mm_sound_mgr_focus_set_reacquisition(const _mm_sound_mgr_focus_param_t *para
 
        /* Find node to set reacquisition */
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               node = (focus_node_t *)list->data;
-               if (CHECK_MY_NODE(node, param)) {
-                       if (node->reacquisition == param->reacquisition) {
-                               debug_msg("it is already set as same value of reacquisition(%d)\n", param->reacquisition);
-                               goto FINISH;
-                       }
-                       node->reacquisition = param->reacquisition;
-                       debug_msg("found a node(pid[%d]/handle_id[%d]) to set reacquisition to (%d)\n", node->pid, node->handle_id, param->reacquisition);
-                       my_node = node;
-                       break;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
+               CONTINUE_IF_NOT_MY_FOCUS_NODE(node, param);
+
+               if (node->reacquisition == param->reacquisition) {
+                       debug_msg("it is already set as same value of reacquisition(%d)\n", param->reacquisition);
+                       goto FINISH;
                }
+               node->reacquisition = param->reacquisition;
+               debug_msg("found a node(pid[%d]/handle_id[%d]) to set reacquisition to (%d)\n", node->pid, node->handle_id, param->reacquisition);
+               my_node = node;
+               break;
        }
        if (my_node == NULL) {
                debug_error("could not find any node of pid[%d]/handle_id[%d]\n", param->pid, param->handle_id);
@@ -927,8 +927,7 @@ int mm_sound_mgr_focus_set_reacquisition(const _mm_sound_mgr_focus_param_t *para
 
        if (!param->reacquisition) {
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
                                if (node->taken_by_id[i].pid == param->pid) {
                                        /* victim node : append my node's taken info to my victim node */
@@ -945,8 +944,7 @@ int mm_sound_mgr_focus_set_reacquisition(const _mm_sound_mgr_focus_param_t *para
                }
        } else {
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
                                /* rollback and reset backup info. */
                                if (node->taken_by_id[i].pid && (node->taken_by_id[i].pid == my_node->taken_backup[i].pid)) {
@@ -986,8 +984,7 @@ int mm_sound_mgr_focus_get_stream_type_of_acquired_focus(focus_type_e focus_type
 
        /* Find node to set reacquisition */
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if (!node->is_for_watch && (node->status & focus_type)) {
                         /* In case of FOCUS_TYPE_BOTH, we use index for FOCUS_TYPE_PLAYBACK's forcedly.
                          * It is because this function can not return both index of option, ext_info results
@@ -1056,14 +1053,14 @@ int mm_sound_mgr_focus_request_acquire(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               node = (focus_node_t *)list->data;
-               if (CHECK_MY_NODE(node, param)) {
-                       my_node = node;
-                       if ((my_node->status > FOCUS_STATUS_DEACTIVATED) && (my_node->status & param->request_type)) {
-                               debug_error("focus status is already activated");
-                               ret = MM_ERROR_SOUND_INVALID_STATE;
-                               goto FINISH;
-                       }
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
+               CONTINUE_IF_NOT_MY_FOCUS_NODE(node, param);
+
+               my_node = node;
+               if ((my_node->status > FOCUS_STATUS_DEACTIVATED) && (my_node->status & param->request_type)) {
+                       debug_error("focus status is already activated");
+                       ret = MM_ERROR_SOUND_INVALID_STATE;
+                       goto FINISH;
                }
        }
 
@@ -1075,8 +1072,7 @@ int mm_sound_mgr_focus_request_acquire(const _mm_sound_mgr_focus_param_t *param)
 
        /* check if the priority of any node is higher than its based on io direction */
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if (my_node == node || node->is_for_watch)
                        continue;
                if (param->request_type == FOCUS_TYPE_BOTH || node->status == FOCUS_STATUS_ACTIVATED_BOTH ||
@@ -1099,9 +1095,10 @@ int mm_sound_mgr_focus_request_acquire(const _mm_sound_mgr_focus_param_t *param)
                param_s->is_for_session = my_node->is_for_session;
                MMSOUND_STRNCPY(param_s->stream_type, my_node->stream_type, MAX_STREAM_TYPE_LEN);
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
+                       if (node == my_node || node->is_for_watch)
                                continue;
-                       if (node == my_node || node->is_for_watch || (node->pid == my_node->pid && node->is_for_session && my_node->is_for_session))
+                       if (node->pid == my_node->pid && node->is_for_session && my_node->is_for_session)
                                continue;
                        if (param_s->request_type == FOCUS_TYPE_BOTH || node->status == FOCUS_STATUS_ACTIVATED_BOTH ||
                                (node->status & param_s->request_type)) {
@@ -1114,9 +1111,9 @@ int mm_sound_mgr_focus_request_acquire(const _mm_sound_mgr_focus_param_t *param)
                                                /* but, keep going */
                                                ret = MM_ERROR_NONE;
                                        }
-                                       if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN)) {
+                                       if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN))
                                                need_to_trigger_watch_cb = false;
-                                       }
+
                                        need_to_trigger_monitor_cb = false;
                                }
                        }
@@ -1179,20 +1176,20 @@ int mm_sound_mgr_focus_request_release(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               node = (focus_node_t *)list->data;
-               if (CHECK_MY_NODE(node, param)) {
-                       my_node = node;
-                       if (my_node->status == FOCUS_STATUS_DEACTIVATED) {
-                               debug_error("focus status is already deactivated");
-                               ret = MM_ERROR_SOUND_INVALID_STATE;
-                               goto FINISH;
-                       } else if ((my_node->status != FOCUS_STATUS_ACTIVATED_BOTH) && (my_node->status != (focus_status_e)param->request_type)) {
-                               debug_error("request type is not matched with current focus type");
-                               ret = MM_ERROR_SOUND_INVALID_STATE;
-                               goto FINISH;
-                       }
-                       break;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
+               CONTINUE_IF_NOT_MY_FOCUS_NODE(node, param);
+
+               my_node = node;
+               if (my_node->status == FOCUS_STATUS_DEACTIVATED) {
+                       debug_error("focus status is already deactivated");
+                       ret = MM_ERROR_SOUND_INVALID_STATE;
+                       goto FINISH;
+               } else if ((my_node->status != FOCUS_STATUS_ACTIVATED_BOTH) && (my_node->status != (focus_status_e)param->request_type)) {
+                       debug_error("request type is not matched with current focus type");
+                       ret = MM_ERROR_SOUND_INVALID_STATE;
+                       goto FINISH;
                }
+               break;
        }
 
        if (my_node == NULL) {
@@ -1204,8 +1201,7 @@ int mm_sound_mgr_focus_request_release(const _mm_sound_mgr_focus_param_t *param)
        /* Check if there's activating focus for session for the same PID of incomming param*/
        if (my_node->is_for_session) {
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        if (node == my_node || node->is_for_watch)
                                continue;
                        if (node->pid == my_node->pid && node->is_for_session && node->status) {
@@ -1222,8 +1218,7 @@ int mm_sound_mgr_focus_request_release(const _mm_sound_mgr_focus_param_t *param)
                param_s->is_for_session = my_node->is_for_session;
                MMSOUND_STRNCPY(param_s->stream_type, my_node->stream_type, MAX_STREAM_TYPE_LEN);
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        if (node == my_node || node->is_for_watch)
                                continue;
                        for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
@@ -1287,8 +1282,7 @@ int mm_sound_mgr_focus_set_watch_cb(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if ((node->pid == param->pid) && (node->handle_id == param->handle_id) && node->is_for_watch) {
                        debug_error("the node of pid[%d]/handle_id[%d] for watch focus is already created\n", param->pid, param->handle_id);
                        ret = MM_ERROR_INVALID_ARGUMENT;
@@ -1335,8 +1329,7 @@ int mm_sound_mgr_focus_unset_watch_cb(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if ((node->pid == param->pid) && (node->handle_id == param->handle_id) && node->is_for_watch) {
                        debug_log("found the node of pid[%d]/handle_id[%d] for watch focus\n", param->pid, param->handle_id);
                        __clear_focus_pipe(node);
@@ -1376,8 +1369,7 @@ int mm_sound_mgr_focus_deliver(const _mm_sound_mgr_focus_param_t *param)
        g_list_foreach (g_focus_node_list, (GFunc)_clear_focus_node_list_func, NULL);
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(src_node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(src_node, list);
                if ((src_node->pid == param->pid) && (src_node->handle_id == param->handle_id)) {
                        debug_log("SRC: found the node of pid[%d]/handle_id[%d] for watch focus\n",
                                  param->pid, param->handle_id);
@@ -1399,8 +1391,7 @@ int mm_sound_mgr_focus_deliver(const _mm_sound_mgr_focus_param_t *param)
        }
 
        for (list = g_focus_node_list; list != NULL; list = list->next) {
-               if (!(dst_node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(dst_node, list);
                if ((dst_node->pid == param->pid) && (dst_node->handle_id == param->handle_id_dst)) {
                        debug_log("DST: found the destination node of param, pid[%d]/handle_id[%d]\n",
                                  param->pid, param->handle_id_dst);
@@ -1420,8 +1411,7 @@ int mm_sound_mgr_focus_deliver(const _mm_sound_mgr_focus_param_t *param)
                        continue;
 
                for (list = g_focus_node_list; list != NULL; list = list->next) {
-                       if (!(node = (focus_node_t *)list->data))
-                               continue;
+                       CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                        if ((node->taken_by_id[i].pid == src_node->pid) &&
                            (node->taken_by_id[i].handle_id == src_node->handle_id) &&
                            (node->taken_by_id[i].by_session == false)) {
@@ -1476,8 +1466,7 @@ int mm_sound_mgr_focus_emergent_exit(const _mm_sound_mgr_focus_param_t *param)
 
        list = g_focus_node_list;
        while (list) {
-               if (!(node = (focus_node_t *)list->data))
-                       continue;
+               CONTINUE_IF_LIST_DATA_IS_NULL(node, list);
                if (node->pid != param->pid) {
                        list = list->next;
                        debug_log("node not found, next list = %p",list);
@@ -1496,8 +1485,7 @@ int mm_sound_mgr_focus_emergent_exit(const _mm_sound_mgr_focus_param_t *param)
                        my_node = node;
                        /* update info of nodes that are lost their focus by the process exited */
                        for (list_s = g_focus_node_list; list_s != NULL; list_s = list_s->next) {
-                               if (!(node = (focus_node_t *)list_s->data))
-                                       continue;
+                               CONTINUE_IF_LIST_DATA_IS_NULL(node, list_s);
                                for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
                                        if (node->taken_by_id[i].pid == param->pid) {
                                                if (my_node->taken_by_id[i].pid) {
@@ -1524,8 +1512,7 @@ int mm_sound_mgr_focus_emergent_exit(const _mm_sound_mgr_focus_param_t *param)
                        param_s.request_type = my_node->status;
                        MMSOUND_STRNCPY(param_s.stream_type, my_node->stream_type, MAX_STREAM_TYPE_LEN);
                        for (list_s = g_focus_node_list; list_s != NULL; list_s = list_s->next) {
-                               if (!(node = (focus_node_t *)list_s->data))
-                                       continue;
+                               CONTINUE_IF_LIST_DATA_IS_NULL(node, list_s);
                                if (my_node->pid == node->pid || node->is_for_watch)
                                        continue;
                                for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
index b7ea416..2924c67 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.11.7
+Version:    0.11.8
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0