guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

100/118: Settings: Add bool get()


From: Ludovic Courtès
Subject: 100/118: Settings: Add bool get()
Date: Tue, 19 May 2015 14:45:58 +0000

civodul pushed a commit to branch nix
in repository guix.

commit 55939b1a4b34b904eedba90ac6c14efc6258f40d
Author: Eelco Dolstra <address@hidden>
Date:   Wed Sep 17 15:18:13 2014 +0200

    Settings: Add bool get()
---
 nix/libstore/build.cc   |    4 ++--
 nix/libstore/globals.cc |    8 ++++++++
 nix/libstore/globals.hh |    2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 6d90ce9..36c6ea8 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1811,8 +1811,8 @@ void DerivationGoal::startBuilder()
 
         /* Bind-mount a user-configurable set of directories from the
            host file system. */
-        PathSet dirs = 
tokenizeString<StringSet>(settings.get("build-chroot-dirs", 
DEFAULT_CHROOT_DIRS));
-        PathSet dirs2 = 
tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", ""));
+        PathSet dirs = 
tokenizeString<StringSet>(settings.get("build-chroot-dirs", 
string(DEFAULT_CHROOT_DIRS)));
+        PathSet dirs2 = 
tokenizeString<StringSet>(settings.get("build-extra-chroot-dirs", string("")));
         dirs.insert(dirs2.begin(), dirs2.end());
         for (auto & i : dirs) {
             size_t p = i.find('=');
diff --git a/nix/libstore/globals.cc b/nix/libstore/globals.cc
index 1cbe912..bb08a7d 100644
--- a/nix/libstore/globals.cc
+++ b/nix/libstore/globals.cc
@@ -130,6 +130,14 @@ Strings Settings::get(const string & name, const Strings & 
def)
 }
 
 
+bool Settings::get(const string & name, bool def)
+{
+    bool res = def;
+    _get(res, name);
+    return res;
+}
+
+
 void Settings::update()
 {
     _get(tryFallback, "build-fallback");
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 55f082e..c17e10d 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -25,6 +25,8 @@ struct Settings {
 
     Strings get(const string & name, const Strings & def);
 
+    bool get(const string & name, bool def);
+
     void update();
 
     string pack();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]