From: Jaeyun Jung Date: Fri, 1 Dec 2023 09:03:03 +0000 (+0900) Subject: [CodeClean] cleanup unnecessary line X-Git-Tag: accepted/tizen/unified/20231213.162138~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b313de49f80fbdf7a9a727f55ae5185f94f1434;p=platform%2Fupstream%2Fnnstreamer-edge.git [CodeClean] cleanup unnecessary line Code clean, update log message and remove unnecessary line. Signed-off-by: Jaeyun Jung --- diff --git a/src/libnnstreamer-edge/nnstreamer-edge-aitt.h b/src/libnnstreamer-edge/nnstreamer-edge-aitt.h index 9afc090..2e0b84d 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-aitt.h +++ b/src/libnnstreamer-edge/nnstreamer-edge-aitt.h @@ -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); diff --git a/src/libnnstreamer-edge/nnstreamer-edge-internal.c b/src/libnnstreamer-edge/nnstreamer-edge-internal.c index 22413f3..c08ceb3 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-internal.c +++ b/src/libnnstreamer-edge/nnstreamer-edge-internal.c @@ -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; diff --git a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c index 79185b0..b06095f 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c +++ b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c @@ -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; } /** diff --git a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c index 29997b6..fd1a5f5 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c +++ b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c @@ -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; } /** diff --git a/src/libnnstreamer-edge/nnstreamer-edge-queue.c b/src/libnnstreamer-edge/nnstreamer-edge-queue.c index b0becae..18d994c 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-queue.c +++ b/src/libnnstreamer-edge/nnstreamer-edge-queue.c @@ -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; } /**