diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-05-07 09:45:13 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-05-07 09:45:13 -0700 |
commit | ca604f1af76a9333bb0bd0b2379cff0ec609222f (patch) | |
tree | a1a4a41d6d3d45105d707dc8a0942670363eca78 /030container.cc | |
parent | 5937f1af0ccf8be12ca4a02fde26734ad8380906 (diff) | |
download | mu-ca604f1af76a9333bb0bd0b2379cff0ec609222f.tar.gz |
2934 - all layers running again
Since I switched to a Mac laptop (commit 2725) I've been lax in running test_all_layers because I have to ssh into a server and whatnot. I should just get CI setup somewhere..
Diffstat (limited to '030container.cc')
-rw-r--r-- | 030container.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/030container.cc b/030container.cc index a31d409e..8f8abbf6 100644 --- a/030container.cc +++ b/030container.cc @@ -118,7 +118,31 @@ vector<pair<type_tree*, container_metadata> > Container_metadata, Container_meta :(before "End save_snapshots") Container_metadata_snapshot = Container_metadata; :(before "End restore_snapshots") -Container_metadata = Container_metadata_snapshot; +restore_container_metadata(); +:(before "End One-time Setup") +atexit(clear_container_metadata); +:(code) +// invariant: Container_metadata always contains a superset of Container_metadata_snapshot +void restore_container_metadata() { + for (int i = 0; i < SIZE(Container_metadata); ++i) { + assert(Container_metadata.at(i).first); + if (i < SIZE(Container_metadata_snapshot)) { + assert(Container_metadata.at(i).first == Container_metadata_snapshot.at(i).first); + continue; + } + delete Container_metadata.at(i).first; + Container_metadata.at(i).first = NULL; + } + Container_metadata.resize(SIZE(Container_metadata_snapshot)); +} +void clear_container_metadata() { + Container_metadata_snapshot.clear(); + for (int i = 0; i < SIZE(Container_metadata); ++i) { + delete Container_metadata.at(i).first; + Container_metadata.at(i).first = NULL; + } + Container_metadata.clear(); +} //: do no work in size_of, simply lookup Container_metadata |