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

Function parse_num_opt

dpdk/examples/vhost/main.c:614–632  ·  view source on GitHub ↗

* Parse num options at run time. */

Source from the content-addressed store, hash-verified

612 * Parse num options at run time.
613 */
614static int
615parse_num_opt(const char *q_arg, uint32_t max_valid_value)
616{
617 char *end = NULL;
618 unsigned long num;
619
620 errno = 0;
621
622 /* parse unsigned int string */
623 num = strtoul(q_arg, &end, 10);
624 if ((q_arg[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0))
625 return -1;
626
627 if (num > max_valid_value)
628 return -1;
629
630 return num;
631
632}
633
634/*
635 * Display usage

Callers 1

us_vhost_parse_argsFunction · 0.85

Calls 1

strtoulFunction · 0.85

Tested by

no test coverage detected