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

Function mk_fold

src/pipeline/pass_shell.c:3057–3080  ·  view source on GitHub ↗

A variable's value as make reads it: each backslash-newline, with the * blanks around it, is one space (a value expanded into a recipe line adds * no lines). */

Source from the content-addressed store, hash-verified

3055 * blanks around it, is one space (a value expanded into a recipe line adds
3056 * no lines). */
3057static const char *mk_fold(CBMArena *a, const char *p, size_t n) {
3058 char *out = cbm_arena_alloc(a, n + SKIP_ONE);
3059 if (!out) {
3060 return NULL;
3061 }
3062 size_t o = 0;
3063 for (size_t i = 0; i < n; i++) {
3064 size_t k = i + SKIP_ONE;
3065 k += k < n && p[k] == '\r';
3066 if (p[i] != '\\' || k >= n || p[k] != '\n') {
3067 out[o++] = p[i];
3068 continue;
3069 }
3070 while (o > 0 && (out[o - SKIP_ONE] == ' ' || out[o - SKIP_ONE] == '\t')) {
3071 o--;
3072 }
3073 out[o++] = ' ';
3074 i = k;
3075 while (i + SKIP_ONE < n && (p[i + SKIP_ONE] == ' ' || p[i + SKIP_ONE] == '\t')) {
3076 i++;
3077 }
3078 }
3079 return mk_trim(a, out, o);
3080}
3081
3082static void mk_assign(mk_t *m, TSNode n, bool cond) {
3083 TSNode name = ts_node_child_by_field_name(n, TS_FIELD("name"));

Callers 1

mk_assignFunction · 0.85

Calls 2

mk_trimFunction · 0.85
cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected