From: Konrad Kuchciak Date: Wed, 2 Sep 2020 09:35:32 +0000 (+0200) Subject: Change signatures of cleanup functions X-Git-Tag: accepted/tizen/unified/20200902.213747~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89f05237b3492397f7879298e01788abb9e71121;p=platform%2Fcore%2Fapi%2Fdiagnostics.git Change signatures of cleanup functions Change-Id: Ife96bcc653b2ae5bd7ab548bcab69b2b684ff952 Signed-off-by: Konrad Kuchciak --- diff --git a/include/diagnostics.h b/include/diagnostics.h index 4f07bb4..1806460 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -141,8 +141,13 @@ int diagnostics_data_read(diagnostics_data_h data, void *buf, size_t count, int * @since_tizen 6.0 * * @param[in] data Diagnostics data handle + * + * @return 0 on success, otherwise a negative error value + * @retval #DIAGNOSTICS_ERROR_NONE Success + * @retval #DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported + * @retval #DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid */ -void diagnostics_data_destroy(diagnostics_data_h data); +int diagnostics_data_destroy(diagnostics_data_h data); /** * @brief Gets diagnostics context provider's id. @@ -176,7 +181,7 @@ int diagnostics_get_client_id(diagnostics_ctx_h ctx, char **client_id); * * @return 0 on success, otherwise a negative error value * @retval #DIAGNOSTICS_ERROR_NONE Success - * @retval #DIAGNOSTICS_ERROR_NOT_SUPPORTED Diagnostics data not supported with given context and parameters + * @retval #DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported * @retval #DIAGNOSTICS_ERROR_PERMISSION_DENIED Permission denied * @retval #DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid * @retval #DIAGNOSTICS_ERROR_IO_ERROR Internal error occured @@ -189,8 +194,13 @@ int diagnostics_get_data(diagnostics_ctx_h ctx, const char **params, int params_ * @since_tizen 6.0 * * @param[in] ctx Diagnostics context handle + * + * @return 0 on success, otherwise a negative error value + * @retval #DIAGNOSTICS_ERROR_NONE Success + * @retval #DIAGNOSTICS_ERROR_NOT_SUPPORTED Not supported + * @retval #DIAGNOSTICS_ERROR_INVALID_PARAMETER Provided parameter is invalid */ -void diagnostics_destroy(diagnostics_ctx_h ctx); +int diagnostics_destroy(diagnostics_ctx_h ctx); #ifdef __cplusplus } diff --git a/src/library/diagnostics.c b/src/library/diagnostics.c index 4d781aa..8d5394f 100644 --- a/src/library/diagnostics.c +++ b/src/library/diagnostics.c @@ -344,16 +344,20 @@ int diagnostics_get_data(diagnostics_ctx_h ctx, const char **params, int params_ return DIAGNOSTICS_ERROR_NONE; } -void diagnostics_destroy(diagnostics_ctx_h ctx) { - RET_IF(ctx == NULL); +int diagnostics_destroy(diagnostics_ctx_h ctx) { + RETV_IF(ctx == NULL, DIAGNOSTICS_ERROR_INVALID_PARAMETER); dbus_signal_cleanup(((struct _diagnostics_ctx_s *)ctx)->signal); free(ctx); + + return DIAGNOSTICS_ERROR_NONE; } -void diagnostics_data_destroy(diagnostics_data_h data) { - RET_IF(data == NULL); +int diagnostics_data_destroy(diagnostics_data_h data) { + RETV_IF(data == NULL, DIAGNOSTICS_ERROR_INVALID_PARAMETER); close(((struct _diagnostics_data_s *)data)->fd); free(data); + + return DIAGNOSTICS_ERROR_NONE; }