| 51 | } |
| 52 | |
| 53 | static 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 | |
| 71 | void cbm_yaml_free(cbm_yaml_node_t *root) { |
| 72 | if (!root) { |
no outgoing calls
no test coverage detected