Skip to content

Commit d88d902

Browse files
committed
Refactor: libcrmcommon: Unindent most of for loop in mark_created_attrs
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent c7b33f5 commit d88d902

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

lib/common/xml.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,23 +1409,25 @@ mark_created_attrs(xmlNode *new_xml)
14091409
for (xmlAttr *attr = pcmk__xe_first_attr(new_xml); attr != NULL;
14101410
attr = attr->next) {
14111411

1412+
const char *name = (const char *) attr->name;
14121413
xml_node_private_t *nodepriv = attr->_private;
14131414

1414-
if (pcmk__is_set(nodepriv->flags, pcmk__xf_created)) {
1415-
const char *name = (const char *) attr->name;
1415+
if (!pcmk__is_set(nodepriv->flags, pcmk__xf_created)) {
1416+
continue;
1417+
}
14161418

1417-
pcmk__trace("Created new attribute %s=%s in %s", name,
1418-
pcmk__xml_attr_value(attr), new_xml->name);
1419+
pcmk__trace("Created new attribute %s=%s in %s", name,
1420+
pcmk__xml_attr_value(attr), (const char *) new_xml->name);
14191421

1420-
/* Check ACLs (we can't use the remove-then-create trick because it
1421-
* would modify the attribute position).
1422-
*/
1423-
if (pcmk__check_acl(new_xml, name, pcmk__xf_acl_write)) {
1424-
pcmk__mark_xml_attr_dirty(attr);
1425-
} else {
1426-
// Creation was not allowed, so remove the attribute
1427-
pcmk__xa_remove(attr, true);
1428-
}
1422+
/* Check ACLs (we can't use the remove-then-create trick because it
1423+
* would modify the attribute position).
1424+
*/
1425+
if (pcmk__check_acl(new_xml, name, pcmk__xf_acl_write)) {
1426+
pcmk__mark_xml_attr_dirty(attr);
1427+
1428+
} else {
1429+
// Creation was not allowed, so remove the attribute
1430+
pcmk__xa_remove(attr, true);
14291431
}
14301432
}
14311433
}

0 commit comments

Comments
 (0)