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

Function eal_parse_log_priority

dpdk/lib/eal/common/eal_common_options.c:1363–1390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1361}
1362
1363static int
1364eal_parse_log_priority(const char *level)
1365{
1366 size_t len = strlen(level);
1367 unsigned long tmp;
1368 char *end;
1369 unsigned int i;
1370
1371 if (len == 0)
1372 return -1;
1373
1374 /* look for named values, skip 0 which is not a valid level */
1375 for (i = 1; i <= RTE_LOG_MAX; i++) {
1376 if (strncmp(eal_log_level2str(i), level, len) == 0)
1377 return i;
1378 }
1379
1380 /* not a string, maybe it is numeric */
1381 errno = 0;
1382 tmp = strtoul(level, &end, 0);
1383
1384 /* check for errors */
1385 if (errno != 0 || end == NULL || *end != '\0' ||
1386 tmp >= UINT32_MAX)
1387 return -1;
1388
1389 return tmp;
1390}
1391
1392static int
1393eal_parse_log_level(const char *arg)

Callers 1

eal_parse_log_levelFunction · 0.85

Calls 3

strncmpFunction · 0.85
eal_log_level2strFunction · 0.85
strtoulFunction · 0.85

Tested by

no test coverage detected