[CodeClean] cleanup unnecessary line
authorJaeyun Jung <jy1210.jung@samsung.com>
Fri, 1 Dec 2023 09:03:03 +0000 (18:03 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 6 Dec 2023 10:56:34 +0000 (19:56 +0900)
Code clean, update log message and remove unnecessary line.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
src/libnnstreamer-edge/nnstreamer-edge-aitt.h
src/libnnstreamer-edge/nnstreamer-edge-internal.c
src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c
src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c
src/libnnstreamer-edge/nnstreamer-edge-queue.c

index 9afc0902c2c709e761b0b3c8348d6294098a7dd7..2e0b84d3d936fd6f0b3172721e45ce6225c44523 100644 (file)
@@ -44,6 +44,7 @@ int nns_edge_aitt_publish (nns_edge_aitt_h handle, const void *data, const int l
 
 /**
  * @brief Publish raw data with protocol and QoS.
+ * @note This is internal function for AITT.
  */
 int nns_edge_aitt_publish_full (nns_edge_aitt_h handle, const void *data, const int length, aitt_protocol_e protocol, aitt_qos_e qos);
 
index 22413f3ffa221a3d15efb9997dcaf444c0b37123..c08ceb3b449f7fe060bdc17d97d819949dff18cb 100644 (file)
@@ -1283,13 +1283,13 @@ nns_edge_create_handle (const char *id, nns_edge_connect_type_e connect_type,
 
   ret = nns_edge_metadata_create (&eh->metadata);
   if (ret != NNS_EDGE_ERROR_NONE) {
-    nns_edge_loge ("Failed to create edge metadata");
+    nns_edge_loge ("Failed to create edge metadata.");
     goto error;
   }
 
   ret = nns_edge_queue_create (&eh->send_queue);
   if (NNS_EDGE_ERROR_NONE != ret) {
-    nns_edge_loge ("Failed to create edge queue");
+    nns_edge_loge ("Failed to create edge queue.");
     goto error;
   }
 
@@ -1816,11 +1816,8 @@ nns_edge_send (nns_edge_h edge_h, nns_edge_data_h data_h)
 
   ret = nns_edge_queue_push (eh->send_queue, new_data_h,
       sizeof (nns_edge_data_h), nns_edge_data_release_handle);
-  if (NNS_EDGE_ERROR_NONE != ret) {
+  if (NNS_EDGE_ERROR_NONE != ret)
     nns_edge_loge ("Failed to send data, cannot push data into queue.");
-    nns_edge_unlock (eh);
-    return ret;
-  }
 
   nns_edge_unlock (eh);
   return ret;
index 79185b058a4044efb9e0bfc23453fb2227f82b0f..b06095fb6f685ea1e4dc478ef5208ba13ba200a6 100644 (file)
@@ -157,7 +157,7 @@ _nns_edge_mqtt_init_client (const char *id, const char *topic, const char *host,
 
   mret = nns_edge_queue_create (&bh->message_queue);
   if (NNS_EDGE_ERROR_NONE != mret) {
-    nns_edge_loge ("Failed to create message queue");
+    nns_edge_loge ("Failed to create message queue.");
     goto error;
   }
   bh->mqtt_h = handle;
@@ -453,12 +453,10 @@ nns_edge_mqtt_get_message (nns_edge_broker_h broker_h, void **msg,
    * (Default: 0 for infinite timeout)
    */
   ret = nns_edge_queue_wait_pop (bh->message_queue, timeout, msg, msg_len);
-  if (NNS_EDGE_ERROR_NONE != ret) {
+  if (NNS_EDGE_ERROR_NONE != ret)
     nns_edge_loge ("Failed to get message from mqtt broker within timeout.");
-    return ret;
-  }
 
-  return NNS_EDGE_ERROR_NONE;
+  return ret;
 }
 
 /**
index 29997b6cebafe455b22c835f8a1be3443a64e6ef..fd1a5f5566930a1d8f03350c2c976d694d1ac4b7 100644 (file)
@@ -173,7 +173,7 @@ nns_edge_mqtt_connect (const char *id, const char *topic, const char *host,
   bh->user_data = NULL;
   ret = nns_edge_queue_create (&bh->message_queue);
   if (NNS_EDGE_ERROR_NONE != ret) {
-    nns_edge_loge ("Failed to create message queue");
+    nns_edge_loge ("Failed to create message queue.");
     goto error;
   }
 
@@ -435,12 +435,10 @@ nns_edge_mqtt_get_message (nns_edge_broker_h broker_h, void **msg,
    * (Default: 0 for infinite timeout)
    */
   ret = nns_edge_queue_wait_pop (bh->message_queue, timeout, msg, msg_len);
-  if (NNS_EDGE_ERROR_NONE != ret) {
+  if (NNS_EDGE_ERROR_NONE != ret)
     nns_edge_loge ("Failed to get message from mqtt broker within timeout.");
-    return ret;
-  }
 
-  return NNS_EDGE_ERROR_NONE;
+  return ret;
 }
 
 /**
index b0becae32e122a01cf9b231cba437e5754fddaeb..18d994c568995d2e258ae4badbd9aaff0bc1dc2a 100644 (file)
@@ -266,9 +266,7 @@ nns_edge_queue_pop (nns_edge_queue_h handle, void **data, nns_size_t * size)
   popped = _pop_data (q, false, data, size);
   nns_edge_unlock (q);
 
-  if (!popped || *data == NULL)
-    return NNS_EDGE_ERROR_IO;
-  return NNS_EDGE_ERROR_NONE;
+  return (popped && *data != NULL) ? NNS_EDGE_ERROR_NONE : NNS_EDGE_ERROR_IO;
 }
 
 /**
@@ -307,9 +305,7 @@ nns_edge_queue_wait_pop (nns_edge_queue_h handle, unsigned int timeout,
   popped = _pop_data (q, false, data, size);
   nns_edge_unlock (q);
 
-  if (!popped || *data == NULL)
-    return NNS_EDGE_ERROR_IO;
-  return NNS_EDGE_ERROR_NONE;
+  return (popped && *data != NULL) ? NNS_EDGE_ERROR_NONE : NNS_EDGE_ERROR_IO;
 }
 
 /**