HomeClusterLabs Projects

Refactor: libcrmcommon: Re-macroize do_crm_log_xml()

Description

Refactor: libcrmcommon: Re-macroize do_crm_log_xml()

58342ff converted do_crm_log_xml() from a macro to a function. The
purpose was to allow it to call pcmk__xml_log(), an internal function
that we can't include in a public macro definition.

However, this change had a side effect. Previously, each call to
do_crm_log_xml() had its own libqb log callsite thanks to macro
expansion. Now, there's only one callsite, defined within the
do_crm_log_xml() function body.

For that reason, we'll revert to a macro definition. The macro will now
call a helper function, pcmk_log_xml_impl(), which in turn calls
pcmk__xml_log(). Eventually, when do_crm_log_xml() is replaced with an
internal macro at a compatibility break, we can get rid of the helper.

As a side note, I discovered that all the callsites get freed by
qb_log_fini(), if crm_exit() is called. That takes care of what I
thought was a trivial memory leak that would have been hard to get rid
of in Pacemaker (as opposed to libqb).

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

Details

Provenance
nrwahl2Authored on Jan 28 2023, 6:25 PM
Parents
rPbfaf9c89d706: Refactor: libcrmcommon: New pcmk__output_get_log_level()
Branches
Unknown
Tags
Unknown