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

Function tp_string_array

src/mcp/test_impact_policy.c:491–517  ·  view source on GitHub ↗

Public arrays retain original spellings. Expanded patterns are separate, * so receipt/reporting clients do not lose the project configuration. */

Source from the content-addressed store, hash-verified

489/* Public arrays retain original spellings. Expanded patterns are separate,
490 * so receipt/reporting clients do not lose the project configuration. */
491static bool tp_string_array(cbm_test_policy_t *policy, yyjson_val *value, bool nonempty,
492 const char *const **result, int *count, tp_patterns_t *patterns,
493 bool semantic_perf) {
494 if (!yyjson_is_arr(value))
495 return false;
496 size_t size = yyjson_arr_size(value);
497 if ((nonempty && !size) || size > INT_MAX || size > SIZE_MAX / sizeof(char *))
498 return false;
499 const char **items = size ? cbm_arena_alloc(&policy->arena, size * sizeof(*items)) : NULL;
500 if (size && !items)
501 return false;
502 size_t index, maximum;
503 yyjson_val *item;
504 yyjson_arr_foreach(value, index, maximum, item) {
505 size_t len = 0;
506 const char *text = tp_string(item, &len);
507 if (!text)
508 return false;
509 items[index] = cbm_arena_strndup(&policy->arena, text, len);
510 if (!items[index] ||
511 (patterns && !tp_expand_pattern(policy, patterns, text, len, semantic_perf)))
512 return false;
513 }
514 *result = items;
515 *count = (int)size;
516 return true;
517}
518
519static bool tp_parse_lanes(cbm_test_policy_t *policy, yyjson_val *value) {
520 if (!yyjson_is_arr(value) || !yyjson_arr_size(value) || yyjson_arr_size(value) > INT_MAX)

Callers 2

tp_parse_lanesFunction · 0.85
tp_parse_ruleFunction · 0.85

Calls 4

tp_stringFunction · 0.85
tp_expand_patternFunction · 0.85
cbm_arena_allocFunction · 0.50
cbm_arena_strndupFunction · 0.50

Tested by

no test coverage detected