Skip to content

Commit

Permalink
rename the builtin strndup to libnfs_strndup on MINGW32
Browse files Browse the repository at this point in the history
Signed-off-by: Ronnie Sahlberg <[email protected]>
  • Loading branch information
sahlberg committed Aug 17, 2024
1 parent 957dc39 commit 6ff65cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/win32/win32_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ int win32_gettimeofday(struct timeval *tv, struct timezone *tz);
#define DllExport

#ifdef __MINGW32__
char* strndup(const char *s, size_t n);
char* libnfs_strndup(const char *s, size_t n);
#define strndup libnfs_strndup
#endif

struct iovec
Expand Down
4 changes: 4 additions & 0 deletions win32/win32_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ int win32_gettimeofday(struct timeval *tv, struct timezone *tz)
}
#endif

#ifdef __MINGW32__
char* libnfs_strndup(const char* s, size_t n)
#else
char* strndup(const char* s, size_t n)
#endif
{
size_t len;
for(len=0; len<n && s[len]; len++);
Expand Down

0 comments on commit 6ff65cb

Please sign in to comment.