MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / yaml_document_delete

Function yaml_document_delete

external/libyaml/src/api.c:1122–1158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1120 */
1121
1122YAML_DECLARE(void)
1123yaml_document_delete(yaml_document_t *document)
1124{
1125 yaml_tag_directive_t *tag_directive;
1126
1127 assert(document); /* Non-NULL document object is expected. */
1128
1129 while (!STACK_EMPTY(&context, document->nodes)) {
1130 yaml_node_t node = POP(&context, document->nodes);
1131 yaml_free(node.tag);
1132 switch (node.type) {
1133 case YAML_SCALAR_NODE:
1134 yaml_free(node.data.scalar.value);
1135 break;
1136 case YAML_SEQUENCE_NODE:
1137 STACK_DEL(&context, node.data.sequence.items);
1138 break;
1139 case YAML_MAPPING_NODE:
1140 STACK_DEL(&context, node.data.mapping.pairs);
1141 break;
1142 default:
1143 assert(0); /* Should not happen. */
1144 }
1145 }
1146 STACK_DEL(&context, document->nodes);
1147
1148 yaml_free(document->version_directive);
1149 for (tag_directive = document->tag_directives.start;
1150 tag_directive != document->tag_directives.end;
1151 tag_directive++) {
1152 yaml_free(tag_directive->handle);
1153 yaml_free(tag_directive->prefix);
1154 }
1155 yaml_free(document->tag_directives.start);
1156
1157 memset(document, 0, sizeof(yaml_document_t));
1158}
1159
1160/**
1161 * Get a document node.

Callers 3

~ParserMethod · 0.85
yaml_parser_loadFunction · 0.85
yaml.hFile · 0.85

Calls 1

yaml_freeFunction · 0.85

Tested by

no test coverage detected