Remove icl_list_clone() 90/60990/1
authoryoungman <yman.jung@samsung.com>
Thu, 3 Mar 2016 07:12:31 +0000 (16:12 +0900)
committeryoungman <yman.jung@samsung.com>
Thu, 3 Mar 2016 07:12:31 +0000 (16:12 +0900)
Change-Id: Ia7e2a55cc8efe4e8b3070d0293334647830ead0c
Signed-off-by: youngman <yman.jung@samsung.com>
lib/icl-list.c
lib/icl-list.h

index 17a45813e99cd0879559c1a6bedf9e62a0c962cb..086b0a9db7c9431e41dafa2108ae8f3a735b6e47 100644 (file)
@@ -645,15 +645,6 @@ API int iotcon_list_foreach_state(iotcon_list_h list, iotcon_list_state_cb cb,
 }
 
 
-static iotcon_value_h _icl_list_get_nth_value(iotcon_list_h list, int pos)
-{
-       RETV_IF(NULL == list, NULL);
-       RETV_IF(NULL == list->list, NULL);
-
-       return g_list_nth_data(list->list, pos);
-}
-
-
 API void iotcon_list_destroy(iotcon_list_h list)
 {
        GList *cur = NULL;
@@ -672,171 +663,3 @@ API void iotcon_list_destroy(iotcon_list_h list)
        }
        free(list);
 }
-
-static int _icl_list_clone_value(iotcon_list_h list, iotcon_list_h ret_list)
-{
-       int i, ret, count;
-       iotcon_value_h value, copied_value;
-
-       count = g_list_length(list->list);
-       for (i = 0; i < count; i++) {
-               value = _icl_list_get_nth_value(list, i);
-               if (NULL == value) {
-                       ERR("_icl_list_get_nth_value() Fail");
-                       return IOTCON_ERROR_INVALID_PARAMETER;
-               }
-               if (list->type != value->type) {
-                       ERR("Type Mismatching(list:%d, value:%d)", list->type, value->type);
-                       return IOTCON_ERROR_INVALID_TYPE;
-               }
-
-               copied_value = icl_value_clone(value);
-               if (NULL == copied_value) {
-                       ERR("icl_value_clone() Fail");
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-
-               ret = icl_list_insert(ret_list, copied_value, -1);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("icl_list_insert() Fail");
-                       icl_value_destroy(copied_value);
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-       }
-
-       return IOTCON_ERROR_NONE;
-}
-
-
-static int _icl_list_clone_list(iotcon_list_h list, iotcon_list_h ret_list)
-{
-       int i, ret, count;
-
-       iotcon_value_h value;
-       iotcon_list_h list_val, copied_list;
-
-       count = g_list_length(list->list);
-       for (i = 0; i < count; i++) {
-               ret = iotcon_list_get_nth_list(list, i, &list_val);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("iotcon_list_get_nth_list() Fail(%d)", ret);
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-
-               copied_list = icl_list_clone(list_val);
-               if (NULL == copied_list) {
-                       ERR("icl_list_clone() Fail");
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-
-               value = icl_value_create_list(copied_list);
-               if (NULL == value) {
-                       ERR("icl_value_create_list(%p) Fail", copied_list);
-                       iotcon_list_destroy(copied_list);
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-
-               ret = icl_list_insert(ret_list, value, -1);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("icl_list_insert(%d) Fail", ret);
-                       icl_value_destroy(value);
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-       }
-
-       return IOTCON_ERROR_NONE;
-}
-
-
-static int _icl_list_clone_state(iotcon_list_h list, iotcon_list_h ret_list)
-{
-       int i, ret, count;
-       iotcon_value_h value;
-       iotcon_state_h state_val;
-       iotcon_state_h copied_state = NULL;
-
-       count = g_list_length(list->list);
-       for (i = 0; i < count; i++) {
-               ret = iotcon_list_get_nth_state(list, i, &state_val);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("iotcon_list_get_nth_state() Fail");
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-
-
-               if (state_val->hash_table) {
-                       g_hash_table_foreach(state_val->hash_table, (GHFunc)icl_state_clone_foreach,
-                                       copied_state);
-               }
-
-               value = icl_value_create_state(copied_state);
-               if (NULL == value) {
-                       ERR("icl_value_create_state(%p) Fail", copied_state);
-                       iotcon_state_destroy(copied_state);
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-
-               ret = icl_list_insert(ret_list, value, -1);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("icl_list_insert(%d) Fail", ret);
-                       icl_value_destroy(value);
-                       return IOTCON_ERROR_REPRESENTATION;
-               }
-       }
-
-       return IOTCON_ERROR_NONE;
-}
-
-
-iotcon_list_h icl_list_clone(iotcon_list_h list)
-{
-       int ret;
-       iotcon_list_h ret_list = NULL;
-
-       RETV_IF(NULL == list, NULL);
-       RETV_IF(NULL == list->list, NULL);
-
-       ret = iotcon_list_create(list->type, &ret_list);
-       if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_list_create(%d) Fail(%d)", list->type, ret);
-               return NULL;
-       }
-
-       switch (list->type) {
-       case IOTCON_TYPE_INT:
-       case IOTCON_TYPE_BOOL:
-       case IOTCON_TYPE_DOUBLE:
-       case IOTCON_TYPE_STR:
-       case IOTCON_TYPE_NULL:
-       case IOTCON_TYPE_BYTE_STR:
-               ret = _icl_list_clone_value(list, ret_list);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("_icl_list_clone_value() Fail(%d)", ret);
-                       iotcon_list_destroy(ret_list);
-                       return NULL;
-               }
-               break;
-       case IOTCON_TYPE_LIST:
-               ret = _icl_list_clone_list(list, ret_list);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("_icl_list_clone_list() Fail(%d)", ret);
-                       iotcon_list_destroy(ret_list);
-                       return NULL;
-               }
-               break;
-       case IOTCON_TYPE_STATE:
-               ret = _icl_list_clone_state(list, ret_list);
-               if (IOTCON_ERROR_NONE != ret) {
-                       ERR("_icl_list_clone_state() Fail(%d)", ret);
-                       iotcon_list_destroy(ret_list);
-                       return NULL;
-               }
-               break;
-       default:
-               ERR("Invalid type(%d)", list->type);
-               iotcon_list_destroy(ret_list);
-               return NULL;
-       }
-
-       return ret_list;
-}
index 92d4dc551bacc9585f9849eb55854ae0bb6d3e33..9b7fe6bd127ca46c227c927b74202687dc3e103a 100644 (file)
@@ -30,8 +30,6 @@ struct icl_list_s {
 int icl_list_remove(iotcon_list_h list, iotcon_value_h val);
 int icl_list_insert(iotcon_list_h list, iotcon_value_h value, int pos);
 
-iotcon_list_h icl_list_clone(iotcon_list_h list);
-
 iotcon_list_h icl_list_ref(iotcon_list_h list);
 
 #endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_LIST_H__ */