HomeClusterLabs Projects

Refactor: libcrmcommon: New pcmk__xe_replace_match()

Description

Refactor: libcrmcommon: New pcmk__xe_replace_match()

To replace replace_xml_child(). Also use pcmkxe_first_child() and
pcmk
xe_next() -- this function can succeed only for element nodes, so
don't try with non-elements.

Maintain a separate function body for replace_xml_child().
pcmk__xe_replace_match() will soon drop its parent argument. Keeping a
separate body for replace_xml_child() is only way to preserve existing
behavior in insane cases where an external caller passes a non-NULL
parent to the root call. replace_xml_child() was only supposed to take a
non-NULL parent in recursive calls, but nothing enforced that.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Feb 11 2024, 5:34 PM
Parents
rP0e752418930f: Refactor: libcrmcommon: Functionize replacing an XML node
Branches
Unknown
Tags
Unknown