HomeClusterLabs Projects

Refactor: libcrmcommon: Drop replace_text() from pcmk__xml_escape()

Description

Refactor: libcrmcommon: Drop replace_text() from pcmk__xml_escape()

Replace it with building up a GString.

replace_text() was an awfully inefficient way to replace substrings. It
copied the entire source string initially. Then every time it needed to
replace a substring, it shifted the tail of the array forward to make
room.

It's better to build up the copy one character at a time.

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

Details

Provenance
nrwahl2Authored on Mar 23 2024, 4:42 PM
Parents
rPacfbd5e01a86: Refactor: libstonithd: Avoid unnecessary allocs in stonith__lha_metadata
Branches
Unknown
Tags
Unknown