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

Function trace_grouped_row_named

tests/test_mcp.c:3051–3084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3049}
3050
3051static yyjson_val *trace_grouped_row_named(yyjson_val *leg, const char *name,
3052 const char **prefix_out) {
3053 if (prefix_out) {
3054 *prefix_out = NULL;
3055 }
3056 yyjson_val *groups = leg ? yyjson_obj_get(leg, "groups") : NULL;
3057 if (!groups || !yyjson_is_arr(groups)) {
3058 return NULL;
3059 }
3060 size_t group_index;
3061 size_t group_max;
3062 yyjson_val *group;
3063 yyjson_arr_foreach(groups, group_index, group_max, group) {
3064 yyjson_val *rows = yyjson_obj_get(group, "rows");
3065 if (!rows || !yyjson_is_arr(rows)) {
3066 continue;
3067 }
3068 size_t row_index;
3069 size_t row_max;
3070 yyjson_val *row;
3071 yyjson_arr_foreach(rows, row_index, row_max, row) {
3072 yyjson_val *row_name = yyjson_is_arr(row) ? yyjson_arr_get(row, 0) : NULL;
3073 if (!row_name || !yyjson_is_str(row_name) ||
3074 strcmp(yyjson_get_str(row_name), name) != 0) {
3075 continue;
3076 }
3077 if (prefix_out) {
3078 *prefix_out = yyjson_get_str(yyjson_obj_get(group, "qn_prefix"));
3079 }
3080 return row;
3081 }
3082 }
3083 return NULL;
3084}
3085
3086/* callers_total/callees_total must count what the caller can enumerate: with
3087 * include_tests=false (default) test-file rows are hidden from the table, so

Callers 1

test_mcp.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected