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

Function node_add_child

src/foundation/yaml.c:53–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53static bool node_add_child(cbm_yaml_node_t *parent, cbm_yaml_node_t *child) {
54 if (!parent || !child) {
55 return false;
56 }
57 if (parent->child_count >= parent->child_cap) {
58 int new_cap =
59 parent->child_cap < YAML_INIT_CAP ? YAML_INIT_CAP : parent->child_cap * PAIR_LEN;
60 cbm_yaml_node_t **new_arr = realloc(parent->children, (size_t)new_cap * sizeof(*new_arr));
61 if (!new_arr) {
62 return false;
63 }
64 parent->children = new_arr;
65 parent->child_cap = new_cap;
66 }
67 parent->children[parent->child_count++] = child;
68 return true;
69}
70
71void cbm_yaml_free(cbm_yaml_node_t *root) {
72 if (!root) {

Callers 2

parse_list_itemFunction · 0.85
parse_key_lineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected