summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/console/dlt-control-common.c6
-rw-r--r--src/daemon/dlt_daemon_client.c5
-rw-r--r--src/daemon/dlt_daemon_event_handler.c28
-rw-r--r--src/lib/dlt_env_ll.c3
-rw-r--r--src/lib/dlt_user.c4
-rw-r--r--src/offlinelogstorage/dlt_offline_logstorage.c2
-rw-r--r--src/shared/dlt_config_file_parser.c17
-rw-r--r--src/tests/dlt-test-stress-user.c4
8 files changed, 24 insertions, 45 deletions
diff --git a/src/console/dlt-control-common.c b/src/console/dlt-control-common.c
index 150bd9a..dbb52b1 100644
--- a/src/console/dlt-control-common.c
+++ b/src/console/dlt-control-common.c
@@ -424,7 +424,7 @@ static int dlt_control_init_connection(DltClient *client, void *cb)
int (*callback)(DltMessage *message, void *data) = cb;
if (!cb || !client) {
- pr_error("%s Invalid parameters (%p, %p)\n", __func__, client, cb);
+ pr_error("%s: Invalid parameters\n", __func__);
return -1;
}
@@ -541,7 +541,7 @@ int dlt_control_send_message(DltControlMsgBody *body, int timeout)
DltMessage *msg = NULL;
if (!body) {
- pr_error("Invalid input (%p).\n", body);
+ pr_error("%s: Invalid input.\n", __func__);
return -1;
}
@@ -601,7 +601,7 @@ int dlt_control_init(int (*response_analyzer)(char *, void *, int),
int verbosity)
{
if (!response_analyzer || !ecuid) {
- pr_error("Invalid input (%p %p).\n", response_analyzer, ecuid);
+ pr_error("%s: Invalid input.\n", __func__);
return -1;
}
diff --git a/src/daemon/dlt_daemon_client.c b/src/daemon/dlt_daemon_client.c
index b3be3df..0d626d7 100644
--- a/src/daemon/dlt_daemon_client.c
+++ b/src/daemon/dlt_daemon_client.c
@@ -215,6 +215,11 @@ int dlt_daemon_client_send(int sock,
{
int sent, ret;
+ if ((daemon == NULL) || (daemon_local == NULL)) {
+ dlt_vlog(LOG_ERR, "%s: Invalid arguments\n", __func__);
+ return DLT_DAEMON_ERROR_UNKNOWN;
+ }
+
if ((sock != DLT_DAEMON_SEND_TO_ALL) && (sock != DLT_DAEMON_SEND_FORCE)) {
/* Send message to specific socket */
if (isatty(sock)) {
diff --git a/src/daemon/dlt_daemon_event_handler.c b/src/daemon/dlt_daemon_event_handler.c
index 2e3d758..1611f7b 100644
--- a/src/daemon/dlt_daemon_event_handler.c
+++ b/src/daemon/dlt_daemon_event_handler.c
@@ -393,16 +393,8 @@ int dlt_connection_check_activate(DltEventHandler *evhdl,
DltConnection *con,
int activation_type)
{
- char local_str[DLT_DAEMON_TEXTBUFSIZE] = { '\0' };
-
if (!evhdl || !con || !con->receiver) {
- snprintf(local_str,
- DLT_DAEMON_TEXTBUFSIZE,
- "%s: wrong parameters (%p %p).\n",
- __func__,
- evhdl,
- con);
- dlt_log(LOG_ERR, local_str);
+ dlt_vlog(LOG_ERR, "%s: wrong parameters.\n", __func__);
return -1;
}
@@ -410,11 +402,7 @@ int dlt_connection_check_activate(DltEventHandler *evhdl,
case ACTIVE:
if (activation_type == DEACTIVATE) {
- snprintf(local_str,
- DLT_DAEMON_TEXTBUFSIZE,
- "Deactivate connection type: %d\n",
- con->type);
- dlt_log(LOG_INFO, local_str);
+ dlt_vlog(LOG_INFO, "Deactivate connection type: %d\n", con->type);
dlt_event_handler_disable_fd(evhdl, con->receiver->fd);
@@ -428,11 +416,7 @@ int dlt_connection_check_activate(DltEventHandler *evhdl,
case INACTIVE:
if (activation_type == ACTIVATE) {
- snprintf(local_str,
- DLT_DAEMON_TEXTBUFSIZE,
- "Activate connection type: %d\n",
- con->type);
- dlt_log(LOG_INFO, local_str);
+ dlt_vlog(LOG_INFO, "Activate connection type: %d\n", con->type);
dlt_event_handler_enable_fd(evhdl,
con->receiver->fd,
@@ -443,11 +427,7 @@ int dlt_connection_check_activate(DltEventHandler *evhdl,
break;
default:
- snprintf(local_str,
- DLT_DAEMON_TEXTBUFSIZE,
- "Unknown connection status: %d\n",
- con->status);
- dlt_log(LOG_ERR, local_str);
+ dlt_vlog(LOG_ERR, "Unknown connection status: %d\n", con->status);
return -1;
}
diff --git a/src/lib/dlt_env_ll.c b/src/lib/dlt_env_ll.c
index e2a9587..8770a02 100644
--- a/src/lib/dlt_env_ll.c
+++ b/src/lib/dlt_env_ll.c
@@ -86,7 +86,7 @@ int dlt_env_extract_id(char **const env, char *id)
int dlt_env_helper_to_lower(char **const env, char *result, int const res_len)
{
int count = 0;
- char ch = *(*env);
+ char ch;
if (!env || !result)
return -1;
@@ -94,7 +94,6 @@ int dlt_env_helper_to_lower(char **const env, char *result, int const res_len)
if (!(*env))
return -1;
- count = 0;
ch = *(*env);
while (ch && (count < res_len - 1) && (ch != ';')) {
diff --git a/src/lib/dlt_user.c b/src/lib/dlt_user.c
index d603783..d040d38 100644
--- a/src/lib/dlt_user.c
+++ b/src/lib/dlt_user.c
@@ -3205,8 +3205,10 @@ DltReturnValue dlt_log_raw(DltContext *handle, DltLogLevelType loglevel, void *d
return DLT_RETURN_WRONG_PARAMETER;
if (dlt_user_log_write_start(handle, &log, loglevel) > 0) {
- if ((ret = dlt_user_log_write_raw(&log, data, length)) < DLT_RETURN_OK)
+ if ((ret = dlt_user_log_write_raw(&log, data, length)) < DLT_RETURN_OK) {
+ dlt_user_free_buffer(&(log.buffer));
return ret;
+ }
if (dlt_user_log_write_finish(&log) < DLT_RETURN_OK)
return DLT_RETURN_ERROR;
diff --git a/src/offlinelogstorage/dlt_offline_logstorage.c b/src/offlinelogstorage/dlt_offline_logstorage.c
index 2a52951..872c47e 100644
--- a/src/offlinelogstorage/dlt_offline_logstorage.c
+++ b/src/offlinelogstorage/dlt_offline_logstorage.c
@@ -395,7 +395,7 @@ DLT_STATIC int dlt_logstorage_read_number(unsigned int *number, char *value)
/* check if string consists of digits only */
for (i = 0; i < len; i++)
- if (isdigit(value[i] == 0)) {
+ if (!isdigit(value[i])) {
dlt_log(LOG_ERR, "Invalid, is not a number \n");
return -1;
}
diff --git a/src/shared/dlt_config_file_parser.c b/src/shared/dlt_config_file_parser.c
index 329e0ad..bf6dfb4 100644
--- a/src/shared/dlt_config_file_parser.c
+++ b/src/shared/dlt_config_file_parser.c
@@ -76,18 +76,11 @@ static void dlt_config_file_trim_line(char *line)
*/
static int dlt_config_file_ignore_line(char *line)
{
- int i = 0;
- int len = strlen(line);
-
- for (i = 0; i < len; i++) {
- if ((line[i] == '#') || (line[i] == ';') || (line[i] == '\n') || (line[i] == '\0'))
- return 0; /* ignore */
- else
- return -1; /* do not ignore */
-
- }
-
- return -1;
+ if ((line[0] == '#') || (line[0] == ';') || (line[0] == '\n') ||
+ (line[0] == '\0'))
+ return 0; /* ignore */
+ else
+ return -1; /* do not ignore */
}
/**
diff --git a/src/tests/dlt-test-stress-user.c b/src/tests/dlt-test-stress-user.c
index 908699f..3dc5925 100644
--- a/src/tests/dlt-test-stress-user.c
+++ b/src/tests/dlt-test-stress-user.c
@@ -164,8 +164,8 @@ int main(int argc, char *argv[])
}
case '?':
{
- if ((optopt == 'd') || (optopt == 'f') || (optopt == 'n') || (optopt == 'r') || (optopt == 'd') ||
- (optopt == 's'))
+ if ((optopt == 'f') || (optopt == 'n') || (optopt == 'r') ||
+ (optopt == 'd') || (optopt == 's'))
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);