| 1684 | } |
| 1685 | |
| 1686 | gboolean |
| 1687 | update_xml_child(xmlNode *child, xmlNode *to_update) |
| 1688 | { |
| 1689 | gboolean can_update = TRUE; |
| 1690 | xmlNode *child_of_child = NULL; |
| 1691 | |
| 1692 | CRM_CHECK(child != NULL, return FALSE); |
| 1693 | CRM_CHECK(to_update != NULL, return FALSE); |
| 1694 | |
| 1695 | if(safe_str_neq(crm_element_name(to_update), crm_element_name(child))) { |
| 1696 | can_update = FALSE; |
| 1697 | |
| 1698 | } else if(safe_str_neq(ID(to_update), ID(child))) { |
| 1699 | can_update = FALSE; |
| 1700 | |
| 1701 | } else if(can_update) { |
| 1702 | #if XML_PARSER_DEBUG |
| 1703 | crm_log_xml_trace(child, "Update match found..."); |
| 1704 | #endif |
| 1705 | add_xml_object(NULL, child, to_update, FALSE); |
| 1706 | } |
| 1707 | |
| 1708 | for(child_of_child = __xml_first_child(child); child_of_child != NULL; child_of_child = __xml_next(child_of_child)) { |
| 1709 | /* only update the first one */ |
| 1710 | if(can_update) { |
| 1711 | break; |
| 1712 | } |
| 1713 | can_update = update_xml_child(child_of_child, to_update); |
| 1714 | } |
| 1715 | |
| 1716 | return can_update; |
| 1717 | } |
| 1718 | |
| 1719 | |
| 1720 | int |
no test coverage detected