MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlTextReaderFreeDoc

Function xmlTextReaderFreeDoc

ThirdParty/libxml2/vtklibxml2/xmlreader.c:484–525  ·  view source on GitHub ↗

* xmlTextReaderFreeDoc: * @reader: the xmlTextReaderPtr used * @cur: pointer to the document * * Free up all the structures used by a document, tree included. */

Source from the content-addressed store, hash-verified

482 * Free up all the structures used by a document, tree included.
483 */
484static void
485xmlTextReaderFreeDoc(xmlTextReaderPtr reader, xmlDocPtr cur) {
486 xmlDtdPtr extSubset, intSubset;
487
488 if (cur == NULL) return;
489
490 if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
491 xmlDeregisterNodeDefaultValue((xmlNodePtr) cur);
492
493 /*
494 * Do this before freeing the children list to avoid ID lookups
495 */
496 if (cur->ids != NULL) xmlFreeIDTable((xmlIDTablePtr) cur->ids);
497 cur->ids = NULL;
498 if (cur->refs != NULL) xmlFreeRefTable((xmlRefTablePtr) cur->refs);
499 cur->refs = NULL;
500 extSubset = cur->extSubset;
501 intSubset = cur->intSubset;
502 if (intSubset == extSubset)
503 extSubset = NULL;
504 if (extSubset != NULL) {
505 xmlUnlinkNode((xmlNodePtr) cur->extSubset);
506 cur->extSubset = NULL;
507 xmlFreeDtd(extSubset);
508 }
509 if (intSubset != NULL) {
510 xmlUnlinkNode((xmlNodePtr) cur->intSubset);
511 cur->intSubset = NULL;
512 xmlFreeDtd(intSubset);
513 }
514
515 if (cur->children != NULL) xmlTextReaderFreeNodeList(reader, cur->children);
516
517 if (cur->version != NULL) xmlFree((char *) cur->version);
518 if (cur->name != NULL) xmlFree((char *) cur->name);
519 if (cur->encoding != NULL) xmlFree((char *) cur->encoding);
520 if (cur->oldNs != NULL) xmlFreeNsList(cur->oldNs);
521 if (cur->URL != NULL) xmlFree((char *) cur->URL);
522 if (cur->dict != NULL) xmlDictFree(cur->dict);
523
524 xmlFree(cur);
525}
526
527/************************************************************************
528 * *

Callers 2

xmlTextReaderCloseFunction · 0.85

Calls 7

xmlFreeIDTableFunction · 0.85
xmlFreeRefTableFunction · 0.85
xmlUnlinkNodeFunction · 0.85
xmlFreeDtdFunction · 0.85
xmlFreeNsListFunction · 0.85
xmlDictFreeFunction · 0.85

Tested by

no test coverage detected