diff options
| author | Russell Belfer <rb@github.com> | 2013-03-18 15:54:35 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2013-03-18 15:54:35 -0700 |
| commit | 324602514fec5ba04fa236c67d633f9b18ad9845 (patch) | |
| tree | bdbf4505fd513029e03a4a1aaa027b23baa24e1e /src/win32 | |
| parent | 41954a49c12a72eda3b3fe02c2752f6831b5dbf9 (diff) | |
| download | libgit2-324602514fec5ba04fa236c67d633f9b18ad9845.tar.gz | |
Fixes and cleanups
Get rid of some dead code, tighten things up a bit, and fix a bug
with core::env test.
Diffstat (limited to 'src/win32')
| -rw-r--r-- | src/win32/findfile.c | 20 | ||||
| -rw-r--r-- | src/win32/findfile.h | 15 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/win32/findfile.c b/src/win32/findfile.c index 6cdea8541..bc36b6b45 100644 --- a/src/win32/findfile.c +++ b/src/win32/findfile.c @@ -17,7 +17,7 @@ #define REG_MSYSGIT_INSTALL L"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Git_is1" #endif -int win32_expand_path(struct win32_path *s_root, const wchar_t *templ) +int git_win32__expand_path(struct git_win32__path *s_root, const wchar_t *templ) { s_root->len = ExpandEnvironmentStringsW(templ, s_root->path, MAX_PATH); return s_root->len ? 0 : -1; @@ -33,8 +33,8 @@ static int win32_path_utf16_to_8(git_buf *path_utf8, const wchar_t *path_utf16) return git_buf_sets(path_utf8, temp_utf8); } -int win32_find_file( - git_buf *path, const struct win32_path *root, const char *filename) +int git_win32__find_file( + git_buf *path, const struct git_win32__path *root, const char *filename) { size_t len, alloc_len; wchar_t *file_utf16 = NULL; @@ -89,7 +89,7 @@ static wchar_t* win32_walkpath(wchar_t *path, wchar_t *buf, size_t buflen) static int win32_find_git_in_path(git_buf *buf, const wchar_t *gitexe) { wchar_t *env = _wgetenv(L"PATH"), lastch; - struct win32_path root; + struct git_win32__path root; size_t gitexe_len = wcslen(gitexe); if (!env) @@ -126,7 +126,7 @@ static int win32_find_git_in_registry( { HKEY hKey; DWORD dwType = REG_SZ; - struct win32_path path16; + struct git_win32__path path16; assert(buf); @@ -158,13 +158,13 @@ static int win32_find_git_in_registry( static int win32_find_existing_dirs( git_buf *out, const wchar_t *tmpl[], char *temp[]) { - struct win32_path path16; + struct git_win32__path path16; git_buf buf = GIT_BUF_INIT; git_buf_clear(out); for (; *tmpl != NULL; tmpl++) { - if (!win32_expand_path(&path16, *tmpl) && + if (!git_win32__expand_path(&path16, *tmpl) && path16.path[0] != L'%' && !_waccess(path16.path, F_OK)) { @@ -180,7 +180,7 @@ static int win32_find_existing_dirs( return (git_buf_oom(out) ? -1 : 0); } -int win32_find_system_dirs(git_buf *out) +int git_win32__find_system_dirs(git_buf *out) { git_buf buf = GIT_BUF_INIT; @@ -207,7 +207,7 @@ int win32_find_system_dirs(git_buf *out) return (git_buf_oom(out) ? -1 : 0); } -int win32_find_global_dirs(git_buf *out) +int git_win32__find_global_dirs(git_buf *out) { char *temp[3]; static const wchar_t *global_tmpls[4] = { @@ -220,7 +220,7 @@ int win32_find_global_dirs(git_buf *out) return win32_find_existing_dirs(out, global_tmpls, temp); } -int win32_find_xdg_dirs(git_buf *out) +int git_win32__find_xdg_dirs(git_buf *out) { char *temp[6]; static const wchar_t *global_tmpls[7] = { diff --git a/src/win32/findfile.h b/src/win32/findfile.h index 300bd168d..fc79e1b72 100644 --- a/src/win32/findfile.h +++ b/src/win32/findfile.h @@ -8,19 +8,20 @@ #ifndef INCLUDE_git_findfile_h__ #define INCLUDE_git_findfile_h__ -struct win32_path { +struct git_win32__path { wchar_t path[MAX_PATH]; DWORD len; }; -extern int win32_expand_path(struct win32_path *s_root, const wchar_t *templ); +extern int git_win32__expand_path( + struct git_win32__path *s_root, const wchar_t *templ); -extern int win32_find_file( - git_buf *path, const struct win32_path *root, const char *filename); +extern int git_win32__find_file( + git_buf *path, const struct git_win32__path *root, const char *filename); -extern int win32_find_system_dirs(git_buf *out); -extern int win32_find_global_dirs(git_buf *out); -extern int win32_find_xdg_dirs(git_buf *out); +extern int git_win32__find_system_dirs(git_buf *out); +extern int git_win32__find_global_dirs(git_buf *out); +extern int git_win32__find_xdg_dirs(git_buf *out); #endif |
