HomeClusterLabs Projects

Low: libcrmcommon: Add type checks to formatted output functions.

Description

Low: libcrmcommon: Add type checks to formatted output functions.

Just check that the out object these visible functions receive is the
type that we expect. For example, pcmk__output_create_html_node should
only do something if it's given an HTML formatter. For all other cases,
it should just return.

For most functions, it's okay to just return without any specific
value. A couple do return some value, and in the case of being called
with the wrong formatter, that value would have to be NULL. The callers
can't do anything useful with that, so in these few cases I am just
asserting if given the wrong type of formatter. It's better to do a
controlled crash than an uncontrolled one.

And while I'm at it, clean up the internal includes in these files a
little bit.

Details

Provenance
clumensAuthored on Mar 23 2021, 9:56 AM
Parents
rP4ae3a1aa53ab: Refactor: libcrmcommon: Be more thorough in checking out != NULL.
Branches
Unknown
Tags
Unknown

Event Timeline