@@ -997,58 +997,6 @@ pcmk__xe_foreach_child(xmlNode *xml, const char *child_element_name,
997
997
998
998
// XML attribute handling
999
999
1000
- /*!
1001
- * \brief Create an XML attribute with specified name and value
1002
- *
1003
- * \param[in,out] node XML node to modify
1004
- * \param[in] name Attribute name to set
1005
- * \param[in] value Attribute value to set
1006
- *
1007
- * \return New value on success, \c NULL otherwise
1008
- * \note This does nothing if node, name, or value are \c NULL or empty.
1009
- */
1010
- const char *
1011
- crm_xml_add (xmlNode * node , const char * name , const char * value )
1012
- {
1013
- // @TODO Replace with internal function that returns the new attribute
1014
- bool dirty = FALSE;
1015
- xmlAttr * attr = NULL ;
1016
-
1017
- CRM_CHECK (node != NULL , return NULL );
1018
- CRM_CHECK (name != NULL , return NULL );
1019
-
1020
- if (value == NULL ) {
1021
- return NULL ;
1022
- }
1023
-
1024
- if (pcmk__xml_doc_all_flags_set (node -> doc , pcmk__xf_tracking )) {
1025
- const char * old = pcmk__xe_get (node , name );
1026
-
1027
- if (old == NULL || value == NULL || strcmp (old , value ) != 0 ) {
1028
- dirty = TRUE;
1029
- }
1030
- }
1031
-
1032
- if (dirty && (pcmk__check_acl (node , name , pcmk__xf_acl_create ) == FALSE)) {
1033
- crm_trace ("Cannot add %s=%s to %s" , name , value , node -> name );
1034
- return NULL ;
1035
- }
1036
-
1037
- attr = xmlSetProp (node , (const xmlChar * ) name , (const xmlChar * ) value );
1038
-
1039
- /* If the attribute already exists, this does nothing. Attribute values
1040
- * don't get private data.
1041
- */
1042
- pcmk__xml_new_private_data ((xmlNode * ) attr );
1043
-
1044
- if (dirty ) {
1045
- pcmk__mark_xml_attr_dirty (attr );
1046
- }
1047
-
1048
- CRM_CHECK (attr && attr -> children && attr -> children -> content , return NULL );
1049
- return (char * )attr -> children -> content ;
1050
- }
1051
-
1052
1000
/*!
1053
1001
* \internal
1054
1002
* \brief Retrieve the value of an XML attribute
@@ -1618,6 +1566,47 @@ expand_idref(xmlNode *input, xmlNode *top)
1618
1566
return pcmk__xe_resolve_idref (input , top );
1619
1567
}
1620
1568
1569
+ const char *
1570
+ crm_xml_add (xmlNode * node , const char * name , const char * value )
1571
+ {
1572
+ bool dirty = FALSE;
1573
+ xmlAttr * attr = NULL ;
1574
+
1575
+ CRM_CHECK (node != NULL , return NULL );
1576
+ CRM_CHECK (name != NULL , return NULL );
1577
+
1578
+ if (value == NULL ) {
1579
+ return NULL ;
1580
+ }
1581
+
1582
+ if (pcmk__xml_doc_all_flags_set (node -> doc , pcmk__xf_tracking )) {
1583
+ const char * old = pcmk__xe_get (node , name );
1584
+
1585
+ if (old == NULL || value == NULL || strcmp (old , value ) != 0 ) {
1586
+ dirty = TRUE;
1587
+ }
1588
+ }
1589
+
1590
+ if (dirty && (pcmk__check_acl (node , name , pcmk__xf_acl_create ) == FALSE)) {
1591
+ crm_trace ("Cannot add %s=%s to %s" , name , value , node -> name );
1592
+ return NULL ;
1593
+ }
1594
+
1595
+ attr = xmlSetProp (node , (const xmlChar * ) name , (const xmlChar * ) value );
1596
+
1597
+ /* If the attribute already exists, this does nothing. Attribute values
1598
+ * don't get private data.
1599
+ */
1600
+ pcmk__xml_new_private_data ((xmlNode * ) attr );
1601
+
1602
+ if (dirty ) {
1603
+ pcmk__mark_xml_attr_dirty (attr );
1604
+ }
1605
+
1606
+ CRM_CHECK (attr && attr -> children && attr -> children -> content , return NULL );
1607
+ return (char * )attr -> children -> content ;
1608
+ }
1609
+
1621
1610
void
1622
1611
crm_xml_set_id (xmlNode * xml , const char * format , ...)
1623
1612
{
0 commit comments