@@ -1190,6 +1190,26 @@ pcmk__xml_escape(const char *text, enum pcmk__xml_escape_type type)
11901190 return g_string_free (copy , FALSE);
11911191}
11921192
1193+ /*!
1194+ * \internal
1195+ * \brief Set the \c pcmk__xf_created flag on an attribute
1196+ *
1197+ * \param[in,out] attr XML attribute
1198+ * \param[in] user_data Ignored
1199+ *
1200+ * \return \c true (to continue iterating)
1201+ *
1202+ * \note This is compatible with \c pcmk__xe_foreach_attr().
1203+ */
1204+ static bool
1205+ mark_attr_created (xmlAttr * attr , void * user_data )
1206+ {
1207+ xml_node_private_t * nodepriv = attr -> _private ;
1208+
1209+ pcmk__set_xml_flags (nodepriv , pcmk__xf_created );
1210+ return true;
1211+ }
1212+
11931213/*!
11941214 * \internal
11951215 * \brief Add an XML attribute to a node, marked as deleted
@@ -1404,12 +1424,7 @@ static void
14041424xml_diff_attrs (xmlNode * old_xml , xmlNode * new_xml )
14051425{
14061426 // Cleared later if attributes are not really new
1407- for (xmlAttr * attr = pcmk__xe_first_attr (new_xml ); attr != NULL ;
1408- attr = attr -> next ) {
1409- xml_node_private_t * nodepriv = attr -> _private ;
1410-
1411- pcmk__set_xml_flags (nodepriv , pcmk__xf_created );
1412- }
1427+ pcmk__xe_foreach_attr (new_xml , mark_attr_created , NULL );
14131428
14141429 pcmk__xe_foreach_attr (old_xml , mark_attr_diff , new_xml );
14151430 pcmk__xe_foreach_attr (new_xml , check_new_attr_acls , NULL );
0 commit comments