From 9cf8c10a22542ce784c383d7e371797c4b9910ac Mon Sep 17 00:00:00 2001 From: Saya Sugiura Date: Wed, 29 May 2019 17:58:37 +0900 Subject: cleanup: Use dlt_vlog() There were a couple of places which used snprintf-dlt_log. It is now replaced with dlt_vlog(). Signed-off-by: Saya Sugiura --- src/console/dlt-receive.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'src/console/dlt-receive.c') diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c index 9cfad36..aef92b9 100644 --- a/src/console/dlt-receive.c +++ b/src/console/dlt-receive.c @@ -188,13 +188,10 @@ int64_t convert_arg_to_byte_size(char *arg) min_size += 2048 /* DLT_USER_BUF_MAX_SIZE */; if (min_size > result) { - char tmp[256]; - snprintf(tmp, - 256, + dlt_vlog(LOG_ERR, "ERROR: Specified limit: %" PRId64 "is smaller than a the size of a single message: %" PRId64 "!\n", result, min_size); - dlt_log(LOG_ERR, tmp); result = -2; } @@ -212,9 +209,7 @@ int dlt_receive_open_output_file(DltReceiveData *dltdata) if (glob(dltdata->ovalue, GLOB_TILDE | GLOB_NOSORT, NULL, &outer) == 0) { if (dltdata->vflag) { - char tmp[256]; - snprintf(tmp, 256, "File %s already exists, need to rename first\n", dltdata->ovalue); - dlt_log(LOG_INFO, tmp); + dlt_vlog(LOG_INFO, "File %s already exists, need to rename first\n", dltdata->ovalue); } if (dltdata->part_num < 0) { @@ -257,15 +252,12 @@ int dlt_receive_open_output_file(DltReceiveData *dltdata) snprintf(filename, PATH_MAX, "%s.%i.dlt", dltdata->ovaluebase, dltdata->part_num++); if (rename(dltdata->ovalue, filename) != 0) { - char tmp[256]; - snprintf(tmp, 256, "ERROR: rename %s to %s failed with error %s\n", dltdata->ovalue, filename, - strerror(errno)); - dlt_log(LOG_ERR, tmp); + dlt_vlog(LOG_ERR, "ERROR: rename %s to %s failed with error %s\n", + dltdata->ovalue, filename, strerror(errno)); } else if (dltdata->vflag) { - char tmp[256]; - snprintf(tmp, 256, "Renaming existing file from %s to %s\n", dltdata->ovalue, filename); - dlt_log(LOG_INFO, tmp); + dlt_vlog(LOG_INFO, "Renaming existing file from %s to %s\n", + dltdata->ovalue, filename); } } /* if (file_already_exists) */ @@ -483,9 +475,8 @@ int main(int argc, char *argv[]) /* open DLT output file */ if (dltdata.ovalue) { if (dltdata.climit > -1) { - char tmp[256]; - snprintf(tmp, 256, "Using file size limit of %" PRId64 "bytes\n", dltdata.climit); - dlt_log(LOG_INFO, tmp); + dlt_vlog(LOG_INFO, "Using file size limit of %" PRId64 "bytes\n", + dltdata.climit); dltdata.ohandle = dlt_receive_open_output_file(&dltdata); } else { /* in case no limit for the output file is given, we simply overwrite any existing file */ -- cgit v1.2.1