const char *action = NULL; const char *id = NULL; xmlNodePtr res = NULL, dest = NULL;
const char *id = ID(anXmlNode); xmlNodePtr res = NULL;  FNIN();
updateResource(xmlNodePtr cib, cibResource *anXmlNode){	const char *action = NULL;	const char *id = NULL;	xmlNodePtr res = NULL, dest = NULL;	FNIN();		CRM_DEBUG2("Updating " XML_CIB_TAG_RESOURCE " (%s)...",		   ID(anXmlNode));    	res = findResource(cib, ID(anXmlNode));	if (res == NULL) {		CRM_DEBUG2("Update: " XML_CIB_TAG_RESOURCE			   " (%s) did not exist, adding.",			   ID(anXmlNode));				addResource(cib, anXmlNode);	} else {		copy_in_properties(anXmlNode, res);			CRM_DEBUG2("Update: Copying in children for "			   XML_CIB_TAG_RESOURCE " (%s).",			   ID(anXmlNode));				xmlNodePtr iter = anXmlNode->children;		while(iter != NULL) {			if (strcmp(XML_CIB_ATTR_NODEREF, iter->name) == 0) {				id = ID(iter);				action = xmlGetProp(iter,						    XML_CIB_ATTR_ACTION);				dest = find_entity(res,						   XML_CIB_ATTR_NODEREF,						   id,						   FALSE);						cib_delete_node(dest);						if (strcmp("add", action) == 0) {					xmlNodePtr node_copy =						xmlCopyNode(iter, 1);					// remove the action property first					xmlUnsetProp(node_copy,						     XML_CIB_ATTR_ACTION);					xmlAddChild(res, node_copy);				}			}		}	}	FNRET(0);    }