about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/value-to-xml.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-22T00·58+0100
committerVincent Ambo <tazjin@google.com>2020-05-22T00·59+0100
commit986a8f6b75ffa51682cbe730c5c2907296082cd4 (patch)
tree32c266920223bbfbf0beb49689dc05cb8eb1f2b7 /third_party/nix/src/libexpr/value-to-xml.cc
parent42205f27fc820ddc64616d55c04e2ffde1948043 (diff)
fix(3p/nix): Update for usage of new attribute set API r/802
The new attribute set API uses the iterators of the btree_map
directly. This requires changes in various files because the internals
of libexpr are very entangled.

This code runs and compiles, but there is a bug causing empty
attribute sets to be assigned incorrectly.
Diffstat (limited to 'third_party/nix/src/libexpr/value-to-xml.cc')
-rw-r--r--third_party/nix/src/libexpr/value-to-xml.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/third_party/nix/src/libexpr/value-to-xml.cc b/third_party/nix/src/libexpr/value-to-xml.cc
index d2b5c66f1f5f..149bf764f0f9 100644
--- a/third_party/nix/src/libexpr/value-to-xml.cc
+++ b/third_party/nix/src/libexpr/value-to-xml.cc
@@ -31,11 +31,11 @@ static void showAttrs(EvalState& state, bool strict, bool location,
   StringSet names;
 
   for (auto& i : attrs) {
-    names.insert(i.name);
+    names.insert(i.second.name);
   }
 
   for (auto& i : names) {
-    Attr& a(*attrs.find(state.symbols.Create(i)));
+    auto& [_, a] = *attrs.find(state.symbols.Create(i));
 
     XMLAttrs xmlAttrs;
     xmlAttrs["name"] = i;
@@ -43,7 +43,7 @@ static void showAttrs(EvalState& state, bool strict, bool location,
       posToXML(xmlAttrs, *a.pos);
     }
 
-    XMLOpenElement _(doc, "attr", xmlAttrs);
+    XMLOpenElement elem(doc, "attr", xmlAttrs);
     printValueAsXML(state, strict, location, *a.value, doc, context, drvsSeen);
   }
 }
@@ -93,20 +93,20 @@ static void printValueAsXML(EvalState& state, bool strict, bool location,
         a = v.attrs->find(state.sDrvPath);
         if (a != v.attrs->end()) {
           if (strict) {
-            state.forceValue(*a->value);
+            state.forceValue(*a->second.value);
           }
-          if (a->value->type == tString) {
-            xmlAttrs["drvPath"] = drvPath = a->value->string.s;
+          if (a->second.value->type == tString) {
+            xmlAttrs["drvPath"] = drvPath = a->second.value->string.s;
           }
         }
 
         a = v.attrs->find(state.sOutPath);
         if (a != v.attrs->end()) {
           if (strict) {
-            state.forceValue(*a->value);
+            state.forceValue(*a->second.value);
           }
-          if (a->value->type == tString) {
-            xmlAttrs["outPath"] = a->value->string.s;
+          if (a->second.value->type == tString) {
+            xmlAttrs["outPath"] = a->second.value->string.s;
           }
         }