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

Function rte_strsplit

dpdk/lib/eal/common/eal_common_string_fns.c:14–41  ·  view source on GitHub ↗

split string into tokens */

Source from the content-addressed store, hash-verified

12
13/* split string into tokens */
14int
15rte_strsplit(char *string, int stringlen,
16 char **tokens, int maxtokens, char delim)
17{
18 int i, tok = 0;
19 int tokstart = 1; /* first token is right at start of string */
20
21 if (string == NULL || tokens == NULL)
22 goto einval_error;
23
24 for (i = 0; i < stringlen; i++) {
25 if (string[i] == '\0' || tok >= maxtokens)
26 break;
27 if (tokstart) {
28 tokstart = 0;
29 tokens[tok++] = &string[i];
30 }
31 if (string[i] == delim) {
32 string[i] = '\0';
33 tokstart = 1;
34 }
35 }
36 return tok;
37
38einval_error:
39 errno = EINVAL;
40 return -1;
41}
42
43/* Copy src string into dst.
44 *

Callers 15

__parse_config_listFunction · 0.85
vip_cfg_handlerFunction · 0.85
vip6_cfg_handlerFunction · 0.85
ipfw_pr_cfg_handlerFunction · 0.85
rss_tbl_cfg_handlerFunction · 0.85
eal_parse_socket_argFunction · 0.85
get_hugepage_dirFunction · 0.85
rte_vfio_get_group_numFunction · 0.85
get_entry_valuesFunction · 0.85

Calls

no outgoing calls

Tested by 7

cmd_ddp_add_parsedFunction · 0.68
test_rte_strsplitFunction · 0.68
mainFunction · 0.68
get_hugepage_pathFunction · 0.68
parse_dma_env_varFunction · 0.68