Skip to content

Conversation

@nrwahl2
Copy link
Contributor

@nrwahl2 nrwahl2 commented Feb 2, 2026

And other assorted changes. This is the next batch from #4013.

I prefer to list the three meaningful values explicitly. Otherwise we
could accept an arbitrary flag that happens to be set in the flag group.

Signed-off-by: Reid Wahl <[email protected]>
Use pcmk__xe_first_attr() and attr_is_not_id().

Signed-off-by: Reid Wahl <[email protected]>
Instead of creating an XPath string and looking for a substring. It
seems clearer this way, though that is debatable.

Signed-off-by: Reid Wahl <[email protected]>
Replace with g_str_has_prefix() in all but one place for clarity.

The remaining place is pcmk__ipc_is_authentic_process_active(). In that
case, use pcmk__str_eq(). Note that the former length argument was
sizeof(last_asked_name), not sizeof(last_asked_name) - 1. This means we
were checking whether the two strings were the same length and every
character matched up to that length -- in other words, we were checking
whether the strings were equal.

Signed-off-by: Reid Wahl <[email protected]>
We return at the very beginning if attr->parent is NULL. element is then
assigned attr->parent, so we know that element is not NULL.

Signed-off-by: Reid Wahl <[email protected]>
The whole function seems clearer to me this way.

Signed-off-by: Reid Wahl <[email protected]>
Notes:
* The tracking flag can never be set when the argument is a document
  node. If node->_private is not NULL, we return before the switch
  statement. But pcmk__xml_doc_all_flags_set() returns false when the
  document's private data is NULL. So tracking is relevant only for
  element, attribute, and comment nodes.
* pcmk__mark_xml_node_dirty() sets the pcmk__xf_dirty flag on the node
  itself as well as all of its parents. For an element, it doesn't
  matter whether we call it before or after creating the attributes'
  private data.

Signed-off-by: Reid Wahl <[email protected]>
Nothing uses these yet.

Signed-off-by: Reid Wahl <[email protected]>
Also rename to reset_doc_private_data(), move the definition to a
position below new_private_data() and above its first caller, and add
Doxygen.

Signed-off-by: Reid Wahl <[email protected]>
To enable this, functionize the pieces of free_private_data().

Signed-off-by: Reid Wahl <[email protected]>
Also rename attr_iter to old_attr and drop the declaration of old_attr
within the body.

Signed-off-by: Reid Wahl <[email protected]>
More precisely, replace xml_diff_old_attrs(). Functionize the for loop
body and call the new function through pcmk__xe_foreach_attr().

Signed-off-by: Reid Wahl <[email protected]>
We can assume that the old and new XML elements are of the same type.

Signed-off-by: Reid Wahl <[email protected]>
Also rename attr_iter to attr, rename attr_name to name, and drop
new_attr variable.

Signed-off-by: Reid Wahl <[email protected]>
Replace mark_created_attrs(). Functionize the for loop body and call the
new function through pcmk__xe_foreach_attr().

Signed-off-by: Reid Wahl <[email protected]>
Use with pcmk__xe_foreach_attr().

Signed-off-by: Reid Wahl <[email protected]>
@nrwahl2 nrwahl2 requested a review from clumens February 2, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant