1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

refactor: use string accessors

Create context, string_view, and c_str, accessors throughout in order to
better support improvements to the underlying string representation.
This commit is contained in:
Tom Bereknyei 2023-09-25 21:30:41 -04:00
parent 7e24dc606b
commit 399ef84420
13 changed files with 56 additions and 46 deletions

View file

@ -1228,7 +1228,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
else {
if (v->type() == nString) {
attrs2["type"] = "string";
attrs2["value"] = v->string.s;
attrs2["value"] = v->c_str();
xml.writeEmptyElement("meta", attrs2);
} else if (v->type() == nInt) {
attrs2["type"] = "int";
@ -1248,7 +1248,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
for (auto elem : v->listItems()) {
if (elem->type() != nString) continue;
XMLAttrs attrs3;
attrs3["value"] = elem->string.s;
attrs3["value"] = elem->c_str();
xml.writeEmptyElement("string", attrs3);
}
} else if (v->type() == nAttrs) {
@ -1260,7 +1260,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
if(a.value->type() != nString) continue;
XMLAttrs attrs3;
attrs3["type"] = globals.state->symbols[i.name];
attrs3["value"] = a.value->string.s;
attrs3["value"] = a.value->c_str();
xml.writeEmptyElement("string", attrs3);
}
}