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

Function oa_get

internal/cbm/openapi.c:99–111  ·  view source on GitHub ↗

The value of `key` in a mapping; a null node for none. */

Source from the content-addressed store, hash-verified

97
98/* The value of `key` in a mapping; a null node for none. */
99static TSNode oa_get(const CBMExtractCtx *ctx, TSNode map, const char *key) {
100 char k[OA_SCALAR_MAX];
101 uint32_t nc = ts_node_is_null(map) ? 0 : ts_node_named_child_count(map);
102 for (uint32_t i = 0; i < nc; i++) {
103 TSNode p = ts_node_named_child(map, i);
104 if (oa_pair(p) &&
105 oa_scalar(ctx, ts_node_child_by_field_name(p, "key", CBM_SZ_3), k, sizeof(k)) &&
106 strcmp(k, key) == 0) {
107 return ts_node_child_by_field_name(p, "value", CBM_SZ_5);
108 }
109 }
110 return (TSNode){0};
111}
112
113static const char *oa_dup_scalar(const CBMExtractCtx *ctx, TSNode n) {
114 char v[OA_SCALAR_MAX];

Callers 3

oa_controllerFunction · 0.85
oa_operationFunction · 0.85
cbm_extract_openapiFunction · 0.85

Calls 2

oa_pairFunction · 0.85
oa_scalarFunction · 0.85

Tested by

no test coverage detected