summaryrefslogtreecommitdiff
path: root/lib/librte_cmdline
diff options
context:
space:
mode:
authorDavid Marchand <david.marchand@6wind.com>2018-05-31 10:03:28 +0200
committerThomas Monjalon <thomas@monjalon.net>2018-06-27 18:25:30 +0200
commit3c5b140d18179f82e9de4a30c08980a173f84a5a (patch)
treed5547401921ce2916c3dc4f44d38d6e29f3de5a5 /lib/librte_cmdline
parent0c41aab8e287909c3b2a963c9ba74494f3f1485b (diff)
downloaddpdk-next-eventdev-3c5b140d18179f82e9de4a30c08980a173f84a5a.zip
dpdk-next-eventdev-3c5b140d18179f82e9de4a30c08980a173f84a5a.tar.gz
dpdk-next-eventdev-3c5b140d18179f82e9de4a30c08980a173f84a5a.tar.xz
cmdline: remove useless intermediate buffer
Rather than copy the string, we can use a precision in the format string given to printf. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Diffstat (limited to 'lib/librte_cmdline')
-rw-r--r--lib/librte_cmdline/cmdline_parse.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index 961f9be..9666e90 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -208,9 +208,6 @@ cmdline_parse(struct cmdline *cl, const char * buf)
int err = CMDLINE_PARSE_NOMATCH;
int tok;
cmdline_parse_ctx_t *ctx;
-#ifdef RTE_LIBRTE_CMDLINE_DEBUG
- char debug_buf[BUFSIZ];
-#endif
char *result_buf = result.buf;
if (!cl || !buf)
@@ -250,10 +247,8 @@ cmdline_parse(struct cmdline *cl, const char * buf)
return linelen;
}
-#ifdef RTE_LIBRTE_CMDLINE_DEBUG
- strlcpy(debug_buf, buf, (linelen > 64 ? 64 : linelen));
- debug_printf("Parse line : len=%d, <%s>\n", linelen, debug_buf);
-#endif
+ debug_printf("Parse line : len=%d, <%.*s>\n",
+ linelen, linelen > 64 ? 64 : linelen, buf);
/* parse it !! */
inst = ctx[inst_num];