libexpr: initGC -> initLibExpr

we'll put more stuff in there shortly. unfortunately.

Change-Id: I74be957469c3dcd5157f999e2cf23b1c668426d8
This commit is contained in:
eldritch horrors 2024-11-15 16:15:11 +01:00
parent 3dba1d341a
commit 8088927b90
6 changed files with 11 additions and 11 deletions

View file

@ -144,11 +144,11 @@ static Symbol getName(const AttrName & name, EvalState & state, Env & env)
} }
} }
static bool gcInitialised = false; static bool libexprInitialised = false;
void initGC() void initLibExpr()
{ {
if (gcInitialised) return; if (libexprInitialised) return;
#if HAVE_BOEHMGC #if HAVE_BOEHMGC
/* Initialise the Boehm garbage collector. */ /* Initialise the Boehm garbage collector. */
@ -191,7 +191,7 @@ void initGC()
#endif #endif
gcInitialised = true; libexprInitialised = true;
} }
EvalState::EvalState( EvalState::EvalState(
@ -270,7 +270,7 @@ EvalState::EvalState(
{ {
countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0"; countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0";
assert(gcInitialised); assert(libexprInitialised);
static_assert(sizeof(Env) <= 16, "environment must be <= 16 bytes"); static_assert(sizeof(Env) <= 16, "environment must be <= 16 bytes");

View file

@ -135,9 +135,9 @@ std::ostream & operator << (std::ostream & os, const ValueType t);
/** /**
* Initialise the Boehm GC, if applicable. * Initialise the evaluator (including Boehm GC, if applicable).
*/ */
void initGC(); void initLibExpr();
struct RegexCache; struct RegexCache;

View file

@ -359,7 +359,7 @@ void mainWrapped(int argc, char * * argv)
} }
initNix(); initNix();
initGC(); initLibExpr();
#if __linux__ #if __linux__
if (getuid() == 0) { if (getuid() == 0) {

View file

@ -19,7 +19,7 @@ namespace nix
TEST(Arguments, lookupFileArg) { TEST(Arguments, lookupFileArg) {
initNix(); initNix();
initGC(); initLibExpr();
std::string const unitDataPath = getEnv("_NIX_TEST_UNIT_DATA").value(); std::string const unitDataPath = getEnv("_NIX_TEST_UNIT_DATA").value();
// Meson should be allowed to pass us a relative path here tbh. // Meson should be allowed to pass us a relative path here tbh.

View file

@ -17,7 +17,7 @@ namespace nix {
public: public:
static void SetUpTestSuite() { static void SetUpTestSuite() {
LibStoreTest::SetUpTestSuite(); LibStoreTest::SetUpTestSuite();
initGC(); initLibExpr();
} }
protected: protected:

View file

@ -22,7 +22,7 @@ namespace nix
{ {
TEST(ProgressBar, basicStatusRender) { TEST(ProgressBar, basicStatusRender) {
initNix(); initNix();
initGC(); initLibExpr();
setLogFormat(LogFormat::bar); setLogFormat(LogFormat::bar);
ASSERT_NE(dynamic_cast<ProgressBar *>(logger), nullptr); ASSERT_NE(dynamic_cast<ProgressBar *>(logger), nullptr);