martine/ninja — pull request #193 by evanj (2012-01-05 15:10:23+00:00)
Title: ninja.cc: Clear the rules/variables/state when reloading build.ninja

With the current version, the following produces an error:

touch configure.py && ./ninja

This changeset fixes it. An alternative hacky fix would be to explicitly call the destructor and use placement new to replace it:

state.~State();
new (&state) State();

But this is a pretty obscure C++ feature, and I'm not even sure this is totally 100% legitimate. Using a pointer makes it simple and clear, at the cost of changing all the references in ninja.cc.