aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env/nix-env.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-11-24 20:21:34 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-11-25 16:31:39 +0100
commitb6c8e57056f81fa3c2827a7fdc6f335ec54727bd (patch)
tree5339262007e54fb12a7c1fdce3d2fa30147534db /src/nix-env/nix-env.cc
parentca82967ee3276e2aa8b02ea7e6d19cfd4fa75f4c (diff)
Support range-based for loop over list values
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r--src/nix-env/nix-env.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 4056d973d..0dd0e34a0 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -1149,10 +1149,10 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
} else if (v->type() == nList) {
attrs2["type"] = "strings";
XMLOpenElement m(xml, "meta", attrs2);
- for (unsigned int j = 0; j < v->listSize(); ++j) {
- if (v->listElems()[j]->type() != nString) continue;
+ for (auto elem : v->listItems()) {
+ if (elem->type() != nString) continue;
XMLAttrs attrs3;
- attrs3["value"] = v->listElems()[j]->string.s;
+ attrs3["value"] = elem->string.s;
xml.writeEmptyElement("string", attrs3);
}
} else if (v->type() == nAttrs) {