From b0e92f6d474ce91d7f071f9ed62bbb2015009c58 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 9 Jun 2008 13:52:45 +0000 Subject: * Merged the no-bdb branch (-r10900:HEAD https://svn.nixos.org/repos/nix/nix/branches/no-bdb). --- src/libutil/util.cc | 5 +++-- src/libutil/util.hh | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/util.cc b/src/libutil/util.cc index f978856a96cc..e18f9841fd4d 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -361,9 +361,10 @@ Path createTempDir(const Path & tmpRoot, const Path & prefix, Paths createDirs(const Path & path) { - if (path == "/") return Paths(); - Paths created = createDirs(dirOf(path)); + Paths created; + if (path == "/") return created; if (!pathExists(path)) { + created = createDirs(dirOf(path)); if (mkdir(path.c_str(), 0777) == -1) throw SysError(format("creating directory `%1%'") % path); created.push_back(path); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index d75002b021d3..d52ab3e4d920 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -12,6 +12,10 @@ namespace nix { +#define foreach(it_type, it, collection) \ + for (it_type it = collection.begin(); it != collection.end(); ++it) + + /* Return an environment variable. */ string getEnv(const string & key, const string & def = ""); -- cgit 1.4.1