if (resource->header_options)
iotcon_options_free(resource->header_options);
- resource->header_options = header_options;
+ if (NULL == header_options) {
+ resource->header_options = NULL;
+ return IOTCON_ERROR_NONE;
+ }
+
+ if (true == header_options->has_parent)
+ resource->header_options = ic_options_ref(header_options);
+ else
+ resource->header_options = header_options;
+ resource->header_options->has_parent = true;
return IOTCON_ERROR_NONE;
}
FN_CALL;
RETV_IF(NULL == options, IOTCON_ERROR_INVALID_PARAMETER);
+ RETVM_IF(options->has_parent, IOTCON_ERROR_INVALID_PARAMETER,
+ "Don't modify it. It is already set.");
RETVM_IF(IOTCON_OPTIONS_MAX <= g_hash_table_size(options->hash),
IOTCON_ERROR_OUT_OF_MEMORY, "Options already have maximum elements.");
gboolean ret;
RETV_IF(NULL == options, IOTCON_ERROR_INVALID_PARAMETER);
+ RETVM_IF(options->has_parent, IOTCON_ERROR_INVALID_PARAMETER,
+ "Don't modify it. It is already set.");
ret = g_hash_table_remove(options->hash, GUINT_TO_POINTER(id));
if (FALSE == ret) {
char *resource_type;
RETV_IF(NULL == type, IOTCON_ERROR_INVALID_PARAMETER);
+ RETVM_IF(1 < types->ref_count, IOTCON_ERROR_INVALID_PARAMETER,
+ "Don't modify it. It is already set.");
if (IOTCON_RESOURCE_TYPE_LENGTH_MAX < strlen(type)) {
ERR("The length of type(%s) should be less than or equal to %d.", type,
RETV_IF(NULL == types, IOTCON_ERROR_INVALID_PARAMETER);
RETV_IF(NULL == type, IOTCON_ERROR_INVALID_PARAMETER);
+ RETVM_IF(1 < types->ref_count, IOTCON_ERROR_INVALID_PARAMETER,
+ "Don't modify it. It is already set.");
found_node = g_list_find_custom(types->type_list, type, _ic_resource_types_strcmp);
if (NULL == found_node) {
return IOTCON_ERROR_NO_DATA;
}
+ free(found_node->data);
types->type_list = g_list_delete_link(types->type_list, found_node);
return IOTCON_ERROR_NONE;
options = va_arg(args, iotcon_options_h);
if (resp->header_options)
ic_options_free(resp->header_options);
-
+ if (NULL == options) {
+ resp->header_options = NULL;
+ break;
+ }
if (true == options->has_parent)
resp->header_options = ic_options_ref(options);
else