Skip to content

Commit a5f814f

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

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
@@ -1358,23 +1358,25 @@ mark_created_attrs(xmlNode *new_xml)
13581358
for (xmlAttr *attr = pcmk__xe_first_attr(new_xml); attr != NULL;
13591359
attr = attr->next) {
13601360

1361+
const char *name = (const char *) attr->name;
13611362
xml_node_private_t *nodepriv = attr->_private;
13621363

1363-
if (pcmk__is_set(nodepriv->flags, pcmk__xf_created)) {
1364-
const char *name = (const char *) attr->name;
1364+
if (!pcmk__is_set(nodepriv->flags, pcmk__xf_created)) {
1365+
continue;
1366+
}
13651367

1366-
pcmk__trace("Created new attribute %s=%s in %s", name,
1367-
pcmk__xml_attr_value(attr), new_xml->name);
1368+
pcmk__trace("Created new attribute %s=%s in %s", name,
1369+
pcmk__xml_attr_value(attr), (const char *) new_xml->name);
13681370

1369-
/* Check ACLs (we can't use the remove-then-create trick because it
1370-
* would modify the attribute position).
1371-
*/
1372-
if (pcmk__check_acl(new_xml, name, pcmk__xf_acl_write)) {
1373-
pcmk__mark_xml_attr_dirty(attr);
1374-
} else {
1375-
// Creation was not allowed, so remove the attribute
1376-
pcmk__xa_remove(attr, true);
1377-
}
1371+
/* Check ACLs (we can't use the remove-then-create trick because it
1372+
* would modify the attribute position).
1373+
*/
1374+
if (pcmk__check_acl(new_xml, name, pcmk__xf_acl_write)) {
1375+
pcmk__mark_xml_attr_dirty(attr);
1376+
1377+
} else {
1378+
// Creation was not allowed, so remove the attribute
1379+
pcmk__xa_remove(attr, true);
13781380
}
13791381
}
13801382
}

0 commit comments

Comments
 (0)