MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sh_argv_push

Function sh_argv_push

src/pipeline/pass_shell.c:1012–1039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1010}
1011
1012static void sh_argv_push(sh_argv_t *a, const char *v, bool split, uint32_t b, uint32_t e) {
1013 if (a->n >= a->cap) {
1014 int ncap = a->cap ? a->cap * PAIR_LEN : SH_GROW_MIN;
1015 const char **nv =
1016 cbm_realloc(CBM_MEM_CLASS_OTHER, (void *)a->v, (size_t)ncap * sizeof(*nv));
1017 if (!nv) {
1018 return;
1019 }
1020 a->v = nv;
1021 bool *ns = cbm_realloc(CBM_MEM_CLASS_OTHER, a->split, (size_t)ncap * sizeof(*ns));
1022 if (!ns) {
1023 return;
1024 }
1025 a->split = ns;
1026 uint32_t *nsp =
1027 cbm_realloc(CBM_MEM_CLASS_OTHER, a->span, (size_t)ncap * PAIR_LEN * sizeof(*nsp));
1028 if (!nsp) {
1029 return;
1030 }
1031 a->span = nsp;
1032 a->cap = ncap;
1033 }
1034 a->v[a->n] = v;
1035 a->split[a->n] = split;
1036 a->span[PAIR_LEN * a->n] = b;
1037 a->span[PAIR_LEN * a->n + SKIP_ONE] = e;
1038 a->n++;
1039}
1040
1041static void sh_argv_word(sh_t *s, TSNode w, sh_argv_t *out) {
1042 uint32_t b = ts_node_start_byte(w);

Callers 2

sh_argv_wordFunction · 0.85
sh_findFunction · 0.85

Calls 1

cbm_reallocFunction · 0.85

Tested by

no test coverage detected