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

Function xmlFreeAttribute

ThirdParty/libxml2/vtklibxml2/valid.c:1598–1631  ·  view source on GitHub ↗

* xmlFreeAttribute: * @elem: An attribute * * Deallocate the memory used by an attribute definition */

Source from the content-addressed store, hash-verified

1596 * Deallocate the memory used by an attribute definition
1597 */
1598static void
1599xmlFreeAttribute(xmlAttributePtr attr) {
1600 xmlDictPtr dict;
1601
1602 if (attr == NULL) return;
1603 if (attr->doc != NULL)
1604 dict = attr->doc->dict;
1605 else
1606 dict = NULL;
1607 xmlUnlinkNode((xmlNodePtr) attr);
1608 if (attr->tree != NULL)
1609 xmlFreeEnumeration(attr->tree);
1610 if (dict) {
1611 if ((attr->elem != NULL) && (!xmlDictOwns(dict, attr->elem)))
1612 xmlFree((xmlChar *) attr->elem);
1613 if ((attr->name != NULL) && (!xmlDictOwns(dict, attr->name)))
1614 xmlFree((xmlChar *) attr->name);
1615 if ((attr->prefix != NULL) && (!xmlDictOwns(dict, attr->prefix)))
1616 xmlFree((xmlChar *) attr->prefix);
1617 if ((attr->defaultValue != NULL) &&
1618 (!xmlDictOwns(dict, attr->defaultValue)))
1619 xmlFree((xmlChar *) attr->defaultValue);
1620 } else {
1621 if (attr->elem != NULL)
1622 xmlFree((xmlChar *) attr->elem);
1623 if (attr->name != NULL)
1624 xmlFree((xmlChar *) attr->name);
1625 if (attr->defaultValue != NULL)
1626 xmlFree((xmlChar *) attr->defaultValue);
1627 if (attr->prefix != NULL)
1628 xmlFree((xmlChar *) attr->prefix);
1629 }
1630 xmlFree(attr);
1631}
1632
1633
1634/**

Callers 3

xmlAddAttributeDeclFunction · 0.85
xmlCopyAttributeFunction · 0.85

Calls 3

xmlUnlinkNodeFunction · 0.85
xmlFreeEnumerationFunction · 0.85
xmlDictOwnsFunction · 0.85

Tested by

no test coverage detected