diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-08-18 02:13:51 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-08-18 02:35:28 +0200 |
commit | 84dd3820d41046d35cb8b3bf65e67d0eb7e68f6c (patch) | |
tree | 9a9f028446162d5effe4f5458f60c9bdb628f81a /src/win32 | |
parent | c85e08b1bda30c1a7e0a6e804f81665047fd8005 (diff) | |
download | libgit2-84dd3820d41046d35cb8b3bf65e67d0eb7e68f6c.tar.gz |
posix: Properly handle `snprintf` in all platforms
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/posix.c | 12 | ||||
-rw-r--r-- | src/win32/posix.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/win32/posix.c b/src/win32/posix.c index 1ce3f050c..0e9d3f0f4 100644 --- a/src/win32/posix.c +++ b/src/win32/posix.c @@ -218,3 +218,15 @@ int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr) return vsnprintf(buffer, count, format, argptr); #endif } + +int p_snprintf(char *buffer, size_t count, const char *format, ...) +{ + va_list va; + int r; + + va_start(va, format); + r = p_vsnprintf(buffer, count, format, va); + va_end(va); + + return r; +} diff --git a/src/win32/posix.h b/src/win32/posix.h index efac68e74..536089e44 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -24,5 +24,6 @@ extern int p_readlink(const char *link, char *target, size_t target_len); extern int p_hide_directory__w32(const char *path); extern char *p_realpath(const char *orig_path, char *buffer); extern int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr); +extern int p_snprintf(char *buffer, size_t count, const char *format, ...) GIT_FORMAT_PRINTF(3, 4); #endif |