HomeClusterLabs Projects

Refactor: various: Remove internal uses of crm_xml_replace()

Description

Refactor: various: Remove internal uses of crm_xml_replace()

crm_xml_replace() is basically a version of crm_xml_add() that removes
the attribute if the value argument is NULL.

It logs an assertion and doesn't update the attribute if the old value
matches the new value. This has the potential to cause some strange
memory errors, and it's difficult to update callers to be sure they're
safe.

cib_perform_op() is the only caller where it's unknown whether the value
argument is NULL. There, we now call xml_remove_prop() if value is NULL
or crm_xml_add() otherwise. In the other callers, we know whether value
is NULL, and we can unconditionally call the appropriate function.

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

Details

Provenance
nrwahl2Authored on Aug 5 2023, 8:52 PM
Parents
rPdf1ecb202f6e: Refactor: libcib: New T_CIB_TRANSACTION string constant
Branches
Unknown
Tags
Unknown