MCPcopy Create free account
hub / github.com/ElementsProject/lightning / gather_args

Function gather_args

ccan/ccan/pipecmd/pipecmd.c:12–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10int pipecmd_preserve;
11
12static char **gather_args(const char *arg0, va_list ap)
13{
14 size_t n = 1;
15 char **arr = calloc(sizeof(char *), n + 1);
16
17 if (!arr)
18 return NULL;
19 arr[0] = (char *)arg0;
20
21 while ((arr[n++] = va_arg(ap, char *)) != NULL) {
22 char **narr = realloc(arr, sizeof(char *) * (n + 1));
23 if (!narr) {
24 free(arr);
25 return NULL;
26 }
27 arr = narr;
28 }
29 return arr;
30}
31
32pid_t pipecmdv(int *fd_tochild, int *fd_fromchild, int *fd_errfromchild,
33 const char *cmd, va_list ap)

Callers 1

pipecmdvFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected