image_util_retvm_if(!handle, IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
- transformation_s *_handle = (transformation_s *) calloc(1, sizeof(transformation_s));
- image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ transformation_s *_handle = g_new0(transformation_s, 1);
/* private values init */
_handle->color = MM_UTIL_COLOR_NUM;
/* The queue is a communicator for thread */
_handle->queue = g_async_queue_new_full(__destroy_async_queue);
- if (!_handle->queue) {
- image_util_error("g_async_queue_new failed");
- goto Error;
- }
/* create thread */
_handle->thread = g_thread_new("transform_thread", __transform_thread, (gpointer)_handle->queue);
*handle = (transformation_h) _handle;
return IMAGE_UTIL_ERROR_NONE;
-
-Error:
- if (_handle->queue)
- g_async_queue_unref(_handle->queue);
- if (_handle->thread)
- g_thread_unref(_handle->thread);
- IMAGE_UTIL_SAFE_FREE(_handle);
-
- return IMAGE_UTIL_ERROR_INVALID_OPERATION;
}
int image_util_transform_set_hardware_acceleration(transformation_h handle, bool mode)
_handle->queue = NULL;
}
- IMAGE_UTIL_SAFE_FREE(_handle);
+ IMAGE_UTIL_SAFE_G_FREE(_handle);
image_util_fleave();