From 8088927b90ff84dd37c342e1ef0a91bc8feca6ec Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Fri, 15 Nov 2024 16:15:11 +0100 Subject: [PATCH] libexpr: initGC -> initLibExpr we'll put more stuff in there shortly. unfortunately. Change-Id: I74be957469c3dcd5157f999e2cf23b1c668426d8 --- src/libexpr/eval.cc | 10 +++++----- src/libexpr/eval.hh | 4 ++-- src/nix/main.cc | 2 +- tests/unit/libcmd/args.cc | 2 +- tests/unit/libexpr-support/tests/libexpr.hh | 2 +- tests/unit/libmain/progress-bar.cc | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index d6ad72f3c..f9dbd254e 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -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 /* Initialise the Boehm garbage collector. */ @@ -191,7 +191,7 @@ void initGC() #endif - gcInitialised = true; + libexprInitialised = true; } EvalState::EvalState( @@ -270,7 +270,7 @@ EvalState::EvalState( { countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0"; - assert(gcInitialised); + assert(libexprInitialised); static_assert(sizeof(Env) <= 16, "environment must be <= 16 bytes"); diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 78669e464..9ea8853ef 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -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; diff --git a/src/nix/main.cc b/src/nix/main.cc index cf1f876dd..0d8f7d119 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -359,7 +359,7 @@ void mainWrapped(int argc, char * * argv) } initNix(); - initGC(); + initLibExpr(); #if __linux__ if (getuid() == 0) { diff --git a/tests/unit/libcmd/args.cc b/tests/unit/libcmd/args.cc index 886467ea0..d78fa9872 100644 --- a/tests/unit/libcmd/args.cc +++ b/tests/unit/libcmd/args.cc @@ -19,7 +19,7 @@ namespace nix TEST(Arguments, lookupFileArg) { initNix(); - initGC(); + initLibExpr(); std::string const unitDataPath = getEnv("_NIX_TEST_UNIT_DATA").value(); // Meson should be allowed to pass us a relative path here tbh. diff --git a/tests/unit/libexpr-support/tests/libexpr.hh b/tests/unit/libexpr-support/tests/libexpr.hh index 642632baa..15acf910e 100644 --- a/tests/unit/libexpr-support/tests/libexpr.hh +++ b/tests/unit/libexpr-support/tests/libexpr.hh @@ -17,7 +17,7 @@ namespace nix { public: static void SetUpTestSuite() { LibStoreTest::SetUpTestSuite(); - initGC(); + initLibExpr(); } protected: diff --git a/tests/unit/libmain/progress-bar.cc b/tests/unit/libmain/progress-bar.cc index 2f2c7dc77..0518a89ff 100644 --- a/tests/unit/libmain/progress-bar.cc +++ b/tests/unit/libmain/progress-bar.cc @@ -22,7 +22,7 @@ namespace nix { TEST(ProgressBar, basicStatusRender) { initNix(); - initGC(); + initLibExpr(); setLogFormat(LogFormat::bar); ASSERT_NE(dynamic_cast(logger), nullptr);