MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / find_xml_children

Function find_xml_children

lib/common/xml.c:1720–1753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1718
1719
1720int
1721find_xml_children(xmlNode **children, xmlNode *root,
1722 const char *tag, const char *field, const char *value,
1723 gboolean search_matches)
1724{
1725 int match_found = 0;
1726
1727 CRM_CHECK(root != NULL, return FALSE);
1728 CRM_CHECK(children != NULL, return FALSE);
1729
1730 if(tag != NULL && safe_str_neq(tag, crm_element_name(root))) {
1731
1732 } else if(value != NULL
1733 && safe_str_neq(value, crm_element_value(root, field))) {
1734
1735 } else {
1736 if(*children == NULL) {
1737 *children = create_xml_node(NULL, __FUNCTION__);
1738 }
1739 add_node_copy(*children, root);
1740 match_found = 1;
1741 }
1742
1743 if(search_matches || match_found == 0) {
1744 xmlNode *child = NULL;
1745 for(child = __xml_first_child(root); child != NULL; child = __xml_next(child)) {
1746 match_found += find_xml_children(
1747 children, child, tag, field, value,
1748 search_matches);
1749 }
1750 }
1751
1752 return match_found;
1753}
1754
1755gboolean
1756replace_xml_child(xmlNode *parent, xmlNode *child, xmlNode *update, gboolean delete_only)

Callers

nothing calls this directly

Calls 6

safe_str_neqFunction · 0.85
crm_element_valueFunction · 0.85
create_xml_nodeFunction · 0.85
add_node_copyFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85

Tested by

no test coverage detected