HomeClusterLabs Projects

Fix: all: restrict XML children loops to XML elements where appropriate

This commit no longer exists in the repository. It may have been part of a branch which was deleted.

Description

Fix: all: restrict XML children loops to XML elements where appropriate

xml_first_child() and xml_next() are intended to be used in "for" loops
where all XML node types (elements, comments, etc.) are desired.

xml_first_child_element() and xml_next_element() are intended when
only element children are desired.

Previously, many element-only loops properly used xml_next_element() but
started with
xml_first_child(). In most cases, this would (by lucky
circumstance) work without harm. However, there were cases where a comment as
the first child of an element would case problems (for example,
unpack_resources() would log a configuration error).

Now, __xml_first_child_element() is always used in such cases.

Additionally, there were some loops using xml_first_child()/xml_next() that
clearly were expecting only elements. These have been converted to
xml_first_child_element()/xml_next_element().

Many more cases exist where xml_first_child()/xml_next() is used with IPC
messages and patchsets. This commit does not convert those, though that would
probably be a good idea for the future.

Details

Provenance
kgaillotAuthored on Aug 15 2019, 6:38 PM

Event Timeline

Commit No Longer Exists

This commit no longer exists in the repository.