g_variant_iter_init(&state_iter, value);
_icd_state_value_from_gvariant(repr, &state_iter);
value_list->list = g_list_append(value_list->list, repr);
- g_variant_iter_free(&state_iter);
} while (g_variant_iter_loop(&iter, "v", &value));
} else if (g_variant_is_of_type(value, G_VARIANT_TYPE_ARRAY)) {
static bool _icl_list_dec_ref_count(iotcon_list_h val)
{
- bool ret;
-
RETV_IF(NULL == val, false);
RETVM_IF(val->ref_count <= 0, false, "Invalid Count(%d)", val->ref_count);
val->ref_count--;
if (0 == val->ref_count)
- ret = true;
- else
- ret = false;
+ return true;
- return ret;
+ return false;
}
static int _icl_list_create(iotcon_type_e type, iotcon_list_h *ret_list)
static bool _icl_representation_dec_ref_count(iotcon_representation_h val)
{
- bool ret;
-
- RETV_IF(NULL == val, -1);
+ RETV_IF(NULL == val, false);
RETVM_IF(val->ref_count <= 0, false, "Invalid Count(%d)", val->ref_count);
val->ref_count--;
if (0 == val->ref_count)
- ret = true;
- else
- ret = false;
+ return true;
- return ret;
+ return false;
}
const char *uri_path)
{
RETV_IF(NULL == repr, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == uri_path, IOTCON_ERROR_INVALID_PARAMETER);
free(repr->uri_path);
- repr->uri_path = NULL;
-
- if (NULL == uri_path)
- return IOTCON_ERROR_INVALID_PARAMETER;
-
repr->uri_path = strdup(uri_path);
if (NULL == repr->uri_path) {
ERR("strdup() Fail");
}
-int icl_state_dec_ref_count(iotcon_state_h val)
+static bool _icl_state_dec_ref_count(iotcon_state_h val)
{
- RETV_IF(NULL == val, -1);
- RETVM_IF(val->ref_count <= 0, 0, "Invalid Count(%d)", val->ref_count);
+ RETV_IF(NULL == val, false);
+ RETVM_IF(val->ref_count <= 0, false, "Invalid Count(%d)", val->ref_count);
val->ref_count--;
+ if (0 == val->ref_count)
+ return true;
- return val->ref_count;
+ return false;
}
{
RET_IF(NULL == state);
- if (0 == icl_state_dec_ref_count(state)) {
- g_hash_table_destroy(state->hash_table);
- free(state);
- }
+ if (false == _icl_state_dec_ref_count(state))
+ return;
+
+ g_hash_table_destroy(state->hash_table);
+ free(state);
}
API int iotcon_state_clone(iotcon_state_h state, iotcon_state_h *state_clone)
#include "icl-representation.h"
void icl_state_inc_ref_count(iotcon_state_h val);
-int icl_state_dec_ref_count(iotcon_state_h val);
int icl_state_del_value(iotcon_state_h state, const char *key);