[Data] wrapper function to release data handle
authorJaeyun <jy1210.jung@samsung.com>
Tue, 1 Nov 2022 02:28:53 +0000 (11:28 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Mon, 21 Nov 2022 04:54:32 +0000 (13:54 +0900)
Code clean, add wrapper function to release edge-data handle.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
src/libnnstreamer-edge/nnstreamer-edge-data.c
src/libnnstreamer-edge/nnstreamer-edge-data.h
src/libnnstreamer-edge/nnstreamer-edge-internal.c

index dee77ea5d2a791f6d1b1b3b4f097dc0d6c126585..6c3526411e996b7440f267573bfcda6175039b93 100644 (file)
@@ -79,6 +79,20 @@ nns_edge_data_destroy (nns_edge_data_h data_h)
   return NNS_EDGE_ERROR_NONE;
 }
 
+/**
+ * @brief Internal wrapper function of the nns_edge_data_destory() to avoid build warning of the incompatibe type casting. (See nns_edge_data_destroy_cb())
+ */
+void
+nns_edge_data_release_handle (void *data)
+{
+  nns_edge_data_h data_h = (nns_edge_data_h) data;
+
+  if (data_h) {
+    if (NNS_EDGE_ERROR_NONE != nns_edge_data_destroy (data_h))
+      nns_edge_logw ("Failed to destory the nns-edge data handle.");
+  }
+}
+
 /**
  * @brief Validate edge data handle.
  */
index 8250da967dda4e9641a8638ea59556f606999dca..f6452e3510d270bb305581200d14eb9b7b474b25 100644 (file)
@@ -42,6 +42,11 @@ typedef struct {
   nns_size_t meta_len;
 } nns_edge_data_header_s;
 
+/**
+ * @brief Internal wrapper function of the nns_edge_data_destory() to avoid build warning of the incompatibe type casting. (See nns_edge_data_destroy_cb())
+ */
+void nns_edge_data_release_handle (void *data);
+
 /**
  * @brief Validate edge data handle.
  * @note This is internal function, DO NOT export this.
index fb6ec0dab5ad214bbd77ff25a01a73489d54afdf..b8657f9e4117808e6bfc8ea6c7187b1119b47958 100644 (file)
@@ -1635,18 +1635,6 @@ _nns_edge_is_connected (nns_edge_h edge_h)
   return false;
 }
 
-/**
- * @brief internal wrapper function of the nns_edge_data_destory () to avoid build warning of the incompatibe type casting.
- */
-void
-_nns_edge_data_destroy (nns_edge_data_h data_h)
-{
-  if (data_h) {
-    if (NNS_EDGE_ERROR_NONE != nns_edge_data_destroy (data_h))
-      nns_edge_logw ("Failed to destory the nns-edge data handle.");
-  }
-}
-
 /**
  * @brief Send data to desination (broker or connected node), asynchronously.
  */
@@ -1690,7 +1678,8 @@ nns_edge_send (nns_edge_h edge_h, nns_edge_data_h data_h)
   /* Create new data handle and push it into send-queue. */
   nns_edge_data_copy (data_h, &new_data_h);
 
-  if (!nns_edge_queue_push (eh->send_queue, new_data_h, _nns_edge_data_destroy)) {
+  if (!nns_edge_queue_push (eh->send_queue, new_data_h,
+          nns_edge_data_release_handle)) {
     nns_edge_loge ("Failed to send data, cannot push data into queue.");
     nns_edge_unlock (eh);
     return NNS_EDGE_ERROR_IO;