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

Function subtract_xml_object

lib/common/xml.c:1448–1612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1446}
1447
1448xmlNode *
1449subtract_xml_object(xmlNode *parent, xmlNode *left, xmlNode *right,
1450 gboolean full, gboolean *changed, const char *marker)
1451{
1452 gboolean dummy = FALSE;
1453 gboolean skip = FALSE;
1454 xmlNode *diff = NULL;
1455 xmlNode *right_child = NULL;
1456 xmlNode *left_child = NULL;
1457 xmlAttrPtr xIter = NULL;
1458
1459 const char *id = NULL;
1460 const char *name = NULL;
1461 const char *value = NULL;
1462 const char *right_val = NULL;
1463
1464 int lpc = 0;
1465 static int filter_len = DIMOF(filter);
1466
1467 if(changed == NULL) {
1468 changed = &dummy;
1469 }
1470
1471 if(left == NULL) {
1472 return NULL;
1473 }
1474
1475 id = ID(left);
1476 if(right == NULL) {
1477 xmlNode *deleted = NULL;
1478
1479 crm_trace("Processing <%s id=%s> (complete copy)",
1480 crm_element_name(left), id);
1481 deleted = add_node_copy(parent, left);
1482 crm_xml_add(deleted, XML_DIFF_MARKER, marker);
1483
1484 *changed = TRUE;
1485 return deleted;
1486 }
1487
1488 name = crm_element_name(left);
1489 CRM_CHECK(name != NULL, return NULL);
1490
1491 /* check for XML_DIFF_MARKER in a child */
1492 value = crm_element_value(right, XML_DIFF_MARKER);
1493 if(value != NULL && strcmp(value, "removed:top") == 0) {
1494 crm_trace("We are the root of the deletion: %s.id=%s", name, id);
1495 *changed = TRUE;
1496 free_xml(diff);
1497 return NULL;
1498 }
1499
1500 /* Avoiding creating the full heirarchy would save even more work here */
1501 diff = create_xml_node(parent, name);
1502
1503 /* Reset filter */
1504 for(lpc = 0; lpc < filter_len; lpc++){
1505 filter[lpc].found = FALSE;

Callers 3

diff_xml_object_origFunction · 0.85
apply_xml_diffFunction · 0.85
diff_xml_objectFunction · 0.85

Calls 10

add_node_copyFunction · 0.85
crm_xml_addFunction · 0.85
crm_element_valueFunction · 0.85
free_xmlFunction · 0.85
create_xml_nodeFunction · 0.85
__xml_first_childFunction · 0.85
__xml_nextFunction · 0.85
find_entityFunction · 0.85
crm_first_attrFunction · 0.85
crm_attr_valueFunction · 0.85

Tested by

no test coverage detected