MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cmdline_get_help_num

Function cmdline_get_help_num

dpdk/lib/cmdline/cmdline_parse_num.c:316–336  ·  view source on GitHub ↗

parse an int */

Source from the content-addressed store, hash-verified

314
315/* parse an int */
316int
317cmdline_get_help_num(cmdline_parse_token_hdr_t *tk, char *dstbuf, unsigned int size)
318{
319 struct cmdline_token_num_data nd;
320 int ret;
321
322 if (!tk)
323 return -1;
324
325 memcpy(&nd, &((struct cmdline_token_num *)tk)->num_data, sizeof(nd));
326
327 /* should not happen.... don't so this test */
328 /* if (nd.type >= (sizeof(num_help)/sizeof(const char *))) */
329 /* return -1; */
330
331 ret = strlcpy(dstbuf, num_help[nd.type], size);
332 if (ret < 0)
333 return -1;
334 dstbuf[size-1] = '\0';
335 return 0;
336}

Callers 3

test_parse_num_validFunction · 0.85

Calls 2

memcpyFunction · 0.50
strlcpyFunction · 0.50

Tested by 3

test_parse_num_validFunction · 0.68