diff options
author | Russell Belfer <rb@github.com> | 2013-08-13 09:53:56 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-08-13 09:53:56 -0700 |
commit | ee0656012c213a9589c7a0892f3e4a11caebc664 (patch) | |
tree | 1789c273dfb4a4cb06fd1a714b2a66c15b466f18 /tests-clar/clar_libgit2.c | |
parent | 841034a35ee34190fa1cc136acccfa1a4abaed39 (diff) | |
download | libgit2-ee0656012c213a9589c7a0892f3e4a11caebc664.tar.gz |
Minor win32 fixes and improvements
This is just a bunch of small fixes that I noticed while looking
at the UTF8 and UTF16 path stuff. It fixes a slowdown in looking
for an empty directory (not exiting loop asap), makes the dir name
in the git__DIR structure be a GIT_FLEX_ARRAY to save an allocation,
and fixes some slightly odd assumptions in the cl_getenv helper.
Diffstat (limited to 'tests-clar/clar_libgit2.c')
-rw-r--r-- | tests-clar/clar_libgit2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests-clar/clar_libgit2.c b/tests-clar/clar_libgit2.c index 305581ec2..bf35a68eb 100644 --- a/tests-clar/clar_libgit2.c +++ b/tests-clar/clar_libgit2.c @@ -66,12 +66,13 @@ char *cl_getenv(const char *name) if (alloc_len <= 0) return NULL; - alloc_len = GIT_WIN_PATH_UTF8; cl_assert(value_utf16 = git__calloc(alloc_len, sizeof(wchar_t))); GetEnvironmentVariableW(name_utf16, value_utf16, alloc_len); - cl_assert(value_utf8 = git__malloc(alloc_len)); + alloc_len = alloc_len * 4 + 1; /* worst case UTF16->UTF8 growth */ + cl_assert(value_utf8 = git__calloc(alloc_len, 1)); + git__utf16_to_8(value_utf8, alloc_len, value_utf16); git__free(value_utf16); |