HomeClusterLabs Projects

Refactor: libcrmcommon: Remove insert_spaces() static helper

Description

Refactor: libcrmcommon: Remove insert_spaces() static helper

pcmkxml2text() calls all the functions that currently call
insert_spaces(). It's straightforward to NULL-check buffer and ensure
depth is nonnegative in pcmk
xml2text(). Then the insert_spaces()
helper only saves us about three lines per call. At that point it seems
cleaner to defunctionize it and use loops with an explicitly calculated
number of spaces.

This may trivially improve performance (fewer redundant checks) and code
size (insert_spaces() was inline), but this is mostly for readability.

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

Details

Provenance
nrwahl2Authored on Dec 25 2022, 1:44 AM
Parents
rP7279dd5c0dbb: Refactor: libcrmcommon: Use uint32_t for pcmk__xml_fmt_options args
Branches
Unknown
Tags
Unknown