diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-21 14:59:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-21 14:59:55 +0200 |
commit | 3d9e82fdd5619985b56ca25fb1f89de3dfabc029 (patch) | |
tree | 689c3f2a148574fdaeb48f8d04648707c61230ed /src/win32 | |
parent | 954f5357282233ecdfea226c819f3f3884949cdb (diff) | |
parent | afb04a95af939295d9baebac5bea72c070001d9e (diff) | |
download | libgit2-3d9e82fdd5619985b56ca25fb1f89de3dfabc029.tar.gz |
Merge pull request #4935 from libgit2/ethomson/pcre
Use PCRE for our fallback regex engine when regcomp_l is unavailable
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/path_w32.h | 29 | ||||
-rw-r--r-- | src/win32/posix.h | 3 | ||||
-rw-r--r-- | src/win32/precompiled.h | 2 | ||||
-rw-r--r-- | src/win32/w32_common.h | 39 |
4 files changed, 39 insertions, 34 deletions
diff --git a/src/win32/path_w32.h b/src/win32/path_w32.h index facbced81..afd0aa155 100644 --- a/src/win32/path_w32.h +++ b/src/win32/path_w32.h @@ -8,37 +8,8 @@ #define INCLUDE_win32_path_w32_h__ #include "common.h" - #include "vector.h" -/* - * Provides a large enough buffer to support Windows paths: MAX_PATH is - * 260, corresponding to a maximum path length of 259 characters plus a - * NULL terminator. Prefixing with "\\?\" adds 4 characters, but if the - * original was a UNC path, then we turn "\\server\share" into - * "\\?\UNC\server\share". So we replace the first two characters with - * 8 characters, a net gain of 6, so the maximum length is MAX_PATH+6. - */ -#define GIT_WIN_PATH_UTF16 MAX_PATH+6 - -/* Maximum size of a UTF-8 Win32 path. We remove the "\\?\" or "\\?\UNC\" - * prefixes for presentation, bringing us back to 259 (non-NULL) - * characters. UTF-8 does have 4-byte sequences, but they are encoded in - * UTF-16 using surrogate pairs, which takes up the space of two characters. - * Two characters in the range U+0800 -> U+FFFF take up more space in UTF-8 - * (6 bytes) than one surrogate pair (4 bytes). - */ -#define GIT_WIN_PATH_UTF8 (259 * 3 + 1) - -/* - * The length of a Windows "shortname", for 8.3 compatibility. - */ -#define GIT_WIN_PATH_SHORTNAME 13 - -/* Win32 path types */ -typedef wchar_t git_win32_path[GIT_WIN_PATH_UTF16]; -typedef char git_win32_utf8_path[GIT_WIN_PATH_UTF8]; - /** * Create a Win32 path (in UCS-2 format) from a UTF-8 string. * diff --git a/src/win32/posix.h b/src/win32/posix.h index d5ab2e8f5..e427d64c3 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -60,7 +60,4 @@ extern int p_lstat_posixly(const char *filename, struct stat *buf); extern struct tm * p_localtime_r(const time_t *timer, struct tm *result); extern struct tm * p_gmtime_r(const time_t *timer, struct tm *result); -/* Use the bundled regcomp */ -#define p_regcomp regcomp - #endif diff --git a/src/win32/precompiled.h b/src/win32/precompiled.h index 851a083d5..314383d31 100644 --- a/src/win32/precompiled.h +++ b/src/win32/precompiled.h @@ -13,8 +13,6 @@ #include <sys/types.h> #include <sys/stat.h> -#include <regex.h> - #include <io.h> #include <direct.h> #ifdef GIT_THREADS diff --git a/src/win32/w32_common.h b/src/win32/w32_common.h new file mode 100644 index 000000000..f9e74b947 --- /dev/null +++ b/src/win32/w32_common.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ + +#ifndef INCLUDE_win32_w32_common_h__ +#define INCLUDE_win32_w32_common_h__ + +/* + * Provides a large enough buffer to support Windows paths: MAX_PATH is + * 260, corresponding to a maximum path length of 259 characters plus a + * NULL terminator. Prefixing with "\\?\" adds 4 characters, but if the + * original was a UNC path, then we turn "\\server\share" into + * "\\?\UNC\server\share". So we replace the first two characters with + * 8 characters, a net gain of 6, so the maximum length is MAX_PATH+6. + */ +#define GIT_WIN_PATH_UTF16 MAX_PATH+6 + +/* Maximum size of a UTF-8 Win32 path. We remove the "\\?\" or "\\?\UNC\" + * prefixes for presentation, bringing us back to 259 (non-NULL) + * characters. UTF-8 does have 4-byte sequences, but they are encoded in + * UTF-16 using surrogate pairs, which takes up the space of two characters. + * Two characters in the range U+0800 -> U+FFFF take up more space in UTF-8 + * (6 bytes) than one surrogate pair (4 bytes). + */ +#define GIT_WIN_PATH_UTF8 (259 * 3 + 1) + +/* + * The length of a Windows "shortname", for 8.3 compatibility. + */ +#define GIT_WIN_PATH_SHORTNAME 13 + +/* Win32 path types */ +typedef wchar_t git_win32_path[GIT_WIN_PATH_UTF16]; +typedef char git_win32_utf8_path[GIT_WIN_PATH_UTF8]; + +#endif |