diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-27T15·09-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-27T15·09-0400 |
commit | e94806d03098f1d6e654542500bbea1eaa0ec60b (patch) | |
tree | 4e967f3d39a984d86bb93849d76cab92512a07ce /src/libutil/util.hh | |
parent | 9c2decaa1935ae4bf99a9b723d4eab188f8f88ef (diff) | |
parent | a9e6752bbd888ab8fbc1cda6e4d539b2858c4cef (diff) |
Merge branch 'master' into no-manifests
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 16633a0835a3..0616288cd541 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -17,6 +17,9 @@ namespace nix { #define foreach(it_type, it, collection) \ for (it_type it = (collection).begin(); it != (collection).end(); ++it) +#define foreach_reverse(it_type, it, collection) \ + for (it_type it = (collection).rbegin(); it != (collection).rend(); ++it) + /* Return an environment variable. */ string getEnv(const string & key, const string & def = ""); @@ -60,7 +63,7 @@ Strings readDirectory(const Path & path); /* Read the contents of a file into a string. */ string readFile(int fd); -string readFile(const Path & path); +string readFile(const Path & path, bool drain = false); /* Write a string to a file. */ void writeFile(const Path & path, const string & s); @@ -80,8 +83,7 @@ void computePathSize(const Path & path, returns the number of bytes and blocks freed. */ void deletePath(const Path & path); -void deletePath(const Path & path, unsigned long long & bytesFreed, - unsigned long long & blocksFreed); +void deletePath(const Path & path, unsigned long long & bytesFreed); /* Make a path read-only recursively. */ void makePathReadOnly(const Path & path); |