Squashed 'gitstatus/' changes from 90cbb46b..ae213c54
ae213c54 add "pkg" target to makefile a208375b comments cdeb063d Give ListDir() the same semantics on BSD as on Linux git-subtree-dir: gitstatus git-subtree-split: ae213c540dd6924d3fb153a0860276897c9ba6c8
This commit is contained in:
parent
28301be914
commit
39cf063480
5
Makefile
5
Makefile
|
@ -2,6 +2,7 @@ APPNAME ?= gitstatusd
|
||||||
OBJDIR ?= obj
|
OBJDIR ?= obj
|
||||||
|
|
||||||
CXX ?= g++
|
CXX ?= g++
|
||||||
|
ZSH ?= $(shell command -v zsh 2> /dev/null)
|
||||||
|
|
||||||
VERSION ?= $(shell . ./build.info && printf "%s" "$$gitstatus_version")
|
VERSION ?= $(shell . ./build.info && printf "%s" "$$gitstatus_version")
|
||||||
|
|
||||||
|
@ -33,4 +34,8 @@ $(OBJDIR)/%.o: src/%.cc Makefile build.info | $(OBJDIR)
|
||||||
clean:
|
clean:
|
||||||
rm -rf -- $(OBJDIR)
|
rm -rf -- $(OBJDIR)
|
||||||
|
|
||||||
|
pkg:
|
||||||
|
GITSTATUS_DAEMON= GITSTATUS_CACHE_DIR=$(PWD)/usrbin ./install -f
|
||||||
|
$(or $(ZSH),:) -fc 'for f in *.zsh install; do zcompile -R -- $$f.zwc $$f || exit; done'
|
||||||
|
|
||||||
-include $(OBJS:.o=.dep)
|
-include $(OBJS:.o=.dep)
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace gitstatus {
|
||||||
//
|
//
|
||||||
// // Donates a block to the arena. When the time comes, it'll be freed with
|
// // Donates a block to the arena. When the time comes, it'll be freed with
|
||||||
// // free(p, size, userdata).
|
// // 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 {
|
class Arena {
|
||||||
public:
|
public:
|
||||||
struct Options {
|
struct Options {
|
||||||
|
@ -62,7 +62,7 @@ class Arena {
|
||||||
//
|
//
|
||||||
// void* userdata;
|
// void* userdata;
|
||||||
// void (*alloc)(size_t size, size_t alignment, 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.
|
// 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 ListDir(int dir_fd, Arena& arena, std::vector<char*>& entries, bool precompose_unicode,
|
||||||
bool case_sensitive) {
|
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);
|
DIR* dir = fdopendir(dir_fd);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
CHECK(!close(dir_fd)) << Errno();
|
CHECK(!close(dir_fd)) << Errno();
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
ON_SCOPE_EXIT(&) { CHECK(!closedir(dir)) << Errno(); };
|
ON_SCOPE_EXIT(&) { CHECK(!closedir(dir)) << Errno(); };
|
||||||
entries.clear();
|
|
||||||
while (struct dirent* ent = (errno = 0, readdir(dir))) {
|
while (struct dirent* ent = (errno = 0, readdir(dir))) {
|
||||||
if (Dots(ent->d_name)) continue;
|
if (Dots(ent->d_name)) continue;
|
||||||
entries.push_back(DirenvConvert(arena, *ent, precompose_unicode));
|
entries.push_back(DirenvConvert(arena, *ent, precompose_unicode));
|
||||||
|
|
Loading…
Reference in New Issue