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

Function commands_init

dpdk/app/test/commands.c:360–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358};
359
360int commands_init(void)
361{
362 struct test_command *t;
363 char *commands;
364 int commands_len = 0;
365
366 TAILQ_FOREACH(t, &commands_list, next) {
367 commands_len += strlen(t->command) + 1;
368 }
369
370 commands = (char *)calloc(commands_len, sizeof(char));
371 if (!commands)
372 return -1;
373
374 TAILQ_FOREACH(t, &commands_list, next) {
375 strlcat(commands, t->command, commands_len);
376 if (TAILQ_NEXT(t, next) != NULL)
377 strlcat(commands, "#", commands_len);
378 }
379
380 cmd_autotest_autotest.string_data.str = commands;
381 return 0;
382}

Callers 1

mainFunction · 0.85

Calls 2

callocFunction · 0.85
strlcatFunction · 0.50

Tested by

no test coverage detected