diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arena.h | 4 | ||||
-rw-r--r-- | src/dir.cc | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/arena.h b/src/arena.h index 0bad0bfa..569833ca 100644 --- a/src/arena.h +++ b/src/arena.h @@ -37,7 +37,7 @@ namespace gitstatus { // // // Donates a block to the arena. When the time comes, it'll be freed with // // free(p, size, userdata). -// void Donate(void* p, size_t size, void* userdata, void(*free)(void*, void*)); +// void Donate(void* p, size_t size, void* userdata, void(*free)(void*, size_t, void*)); class Arena { public: struct Options { @@ -62,7 +62,7 @@ class Arena { // // void* userdata; // void (*alloc)(size_t size, size_t alignment, void* userdata); - // void (*free)(size_t size, void* userdata); + // void (*free)(void* p, size_t size, void* userdata); }; // Requires: opt.min_block_size <= opt.max_block_size. @@ -211,14 +211,15 @@ char* DirenvConvert(Arena& arena, struct dirent& ent, bool do_convert) { bool ListDir(int dir_fd, Arena& arena, std::vector<char*>& entries, bool precompose_unicode, bool case_sensitive) { - VERIFY((dir_fd = dup(dir_fd)) >= 0); + entries.clear(); + dir_fd = dup(dir_fd); + if (dir_fd < 0) return false; DIR* dir = fdopendir(dir_fd); if (!dir) { CHECK(!close(dir_fd)) << Errno(); - return -1; + return false; } ON_SCOPE_EXIT(&) { CHECK(!closedir(dir)) << Errno(); }; - entries.clear(); while (struct dirent* ent = (errno = 0, readdir(dir))) { if (Dots(ent->d_name)) continue; entries.push_back(DirenvConvert(arena, *ent, precompose_unicode)); |