summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-05-25 16:44:59 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-06-24 17:27:22 +0100
commitf6530438f476220547ad46fcc1bfcc0f796f7733 (patch)
tree449fa8e6f1b6500a1faf7edcf8d3bcdd8212e679 /src
parentb11eb08f59181a83cf3091a62fd434db911914a6 (diff)
downloadlibgit2-f6530438f476220547ad46fcc1bfcc0f796f7733.tar.gz
win32: stop inlining file_attribute_to_stat
Move `git_win32__file_attribute_to_stat` to a regular function instead of an inlined function. This helps avoid header ordering issues and declarations.
Diffstat (limited to 'src')
-rw-r--r--src/win32/w32_util.c31
-rw-r--r--src/win32/w32_util.h36
2 files changed, 36 insertions, 31 deletions
diff --git a/src/win32/w32_util.c b/src/win32/w32_util.c
index 10e17fcd0..fe4b75bae 100644
--- a/src/win32/w32_util.c
+++ b/src/win32/w32_util.c
@@ -93,3 +93,34 @@ int git_win32__hidden(bool *out, const char *path)
*out = (attrs & FILE_ATTRIBUTE_HIDDEN) ? true : false;
return 0;
}
+
+int git_win32__file_attribute_to_stat(
+ struct stat *st,
+ const WIN32_FILE_ATTRIBUTE_DATA *attrdata,
+ const wchar_t *path)
+{
+ git_win32__stat_init(st,
+ attrdata->dwFileAttributes,
+ attrdata->nFileSizeHigh,
+ attrdata->nFileSizeLow,
+ attrdata->ftCreationTime,
+ attrdata->ftLastAccessTime,
+ attrdata->ftLastWriteTime);
+
+ if (attrdata->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && path) {
+ git_win32_path target;
+
+ if (git_win32_path_readlink_w(target, path) >= 0) {
+ st->st_mode = (st->st_mode & ~S_IFMT) | S_IFLNK;
+
+ /* st_size gets the UTF-8 length of the target name, in bytes,
+ * not counting the NULL terminator */
+ if ((st->st_size = git__utf16_to_8(NULL, 0, target)) < 0) {
+ git_error_set(GIT_ERROR_OS, "could not convert reparse point name for '%ls'", path);
+ return -1;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/src/win32/w32_util.h b/src/win32/w32_util.h
index 3a7942563..ac191157c 100644
--- a/src/win32/w32_util.h
+++ b/src/win32/w32_util.h
@@ -59,6 +59,11 @@ extern int git_win32__set_hidden(const char *path, bool hidden);
*/
extern int git_win32__hidden(bool *hidden, const char *path);
+extern int git_win32__file_attribute_to_stat(
+ struct stat *st,
+ const WIN32_FILE_ATTRIBUTE_DATA *attrdata,
+ const wchar_t *path);
+
/**
* Converts a FILETIME structure to a struct timespec.
*
@@ -136,35 +141,4 @@ GIT_INLINE(void) git_win32__file_information_to_stat(
fileinfo->ftLastWriteTime);
}
-GIT_INLINE(int) git_win32__file_attribute_to_stat(
- struct stat *st,
- const WIN32_FILE_ATTRIBUTE_DATA *attrdata,
- const wchar_t *path)
-{
- git_win32__stat_init(st,
- attrdata->dwFileAttributes,
- attrdata->nFileSizeHigh,
- attrdata->nFileSizeLow,
- attrdata->ftCreationTime,
- attrdata->ftLastAccessTime,
- attrdata->ftLastWriteTime);
-
- if (attrdata->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && path) {
- git_win32_path target;
-
- if (git_win32_path_readlink_w(target, path) >= 0) {
- st->st_mode = (st->st_mode & ~S_IFMT) | S_IFLNK;
-
- /* st_size gets the UTF-8 length of the target name, in bytes,
- * not counting the NULL terminator */
- if ((st->st_size = git__utf16_to_8(NULL, 0, target)) < 0) {
- git_error_set(GIT_ERROR_OS, "could not convert reparse point name for '%ls'", path);
- return -1;
- }
- }
- }
-
- return 0;
-}
-
#endif