Change signatures of cleanup functions 95/242995/1
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Wed, 2 Sep 2020 09:35:32 +0000 (11:35 +0200)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Wed, 2 Sep 2020 09:36:02 +0000 (11:36 +0200)
Change-Id: Ife96bcc653b2ae5bd7ab548bcab69b2b684ff952
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
include/diagnostics.h
src/library/diagnostics.c

index 4f07bb4..1806460 100644 (file)
@@ -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
 }
index 4d781aa..8d5394f 100644 (file)
@@ -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;
 }