@@ -788,6 +788,24 @@ is_mode_allowed(uint32_t flags, enum pcmk__xml_flags mode)
788788 }
789789}
790790
791+ /*!
792+ * \internal
793+ * \brief Check whether an XML attribute's name is \c PCMK_XA_ID
794+ *
795+ * \param[in] attr Attribute to check
796+ * \param[in] user_data Ignored
797+ *
798+ * \return \c true if the attribute's name is \c PCMK_XA_ID, or \c false
799+ * otherwise
800+ *
801+ * \note This is compatible with \c pcmk__xe_foreach_const_attr().
802+ */
803+ static bool
804+ attr_is_id (const xmlAttr * attr , void * user_data )
805+ {
806+ return pcmk__str_eq ((const char * ) attr -> name , PCMK_XA_ID , pcmk__str_none );
807+ }
808+
791809/*!
792810 * \internal
793811 * \brief Check whether an XML attribute's name is not \c PCMK_XA_ID
@@ -803,7 +821,7 @@ is_mode_allowed(uint32_t flags, enum pcmk__xml_flags mode)
803821static bool
804822attr_is_not_id (xmlAttr * attr , void * user_data )
805823{
806- return !pcmk__str_eq (( const char * ) attr -> name , PCMK_XA_ID , pcmk__str_none );
824+ return !attr_is_id ( attr , user_data );
807825}
808826
809827/*!
@@ -952,14 +970,10 @@ xml_acl_filtered_copy(const char *user, xmlNode *acl_source, xmlNode *xml,
952970 * \return \c true if XML element is implicitly allowed, or \c false otherwise
953971 */
954972static bool
955- implicitly_allowed (xmlNode * xml )
973+ implicitly_allowed (const xmlNode * xml )
956974{
957- for (xmlAttr * attr = pcmk__xe_first_attr (xml ); attr != NULL ;
958- attr = attr -> next ) {
959-
960- if (attr_is_not_id (attr , NULL )) {
961- return false;
962- }
975+ if (!pcmk__xe_foreach_const_attr (xml , attr_is_id , NULL )) {
976+ return false;
963977 }
964978
965979 /* Creation is not implicitly allowed for a descendant of PCMK_XE_ACLS, but
0 commit comments