Skip to content

Commit ec42eaf

Browse files
committed
Hook up Windows compat fnmatch() for Solaris
Since Solaris does not support some of the same flags as glibc fnmatch(), we just use the implementation we have for Windows. Now that it's no longer a windows-specific thing, I moved it into compat/ instead of win32/
1 parent a9d9965 commit ec42eaf

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ FILE(GLOB SRC_H include/git2/*.h)
9797
# On Windows use specific platform sources
9898
IF (WIN32 AND NOT CYGWIN)
9999
ADD_DEFINITIONS(-DWIN32 -D_DEBUG -D_WIN32_WINNT=0x0501)
100-
FILE(GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/win32/*.c)
100+
FILE(GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/win32/*.c src/compat/*.c)
101+
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
102+
FILE(GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/unix/*.c src/compat/*.c)
101103
ELSE()
102104
FILE(GLOB SRC src/*.c src/transports/*.c src/xdiff/*.c src/unix/*.c)
103105
ENDIF ()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* This file is part of libgit2, distributed under the GNU GPL v2 with
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
7-
#ifndef INCLUDE_fnmatch__w32_h__
8-
#define INCLUDE_fnmatch__w32_h__
7+
#ifndef INCLUDE_fnmatch__compat_h__
8+
#define INCLUDE_fnmatch__compat_h__
99

1010
#include "common.h"
1111

src/unix/posix.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
#ifndef INCLUDE_posix__w32_h__
88
#define INCLUDE_posix__w32_h__
99

10-
#include <fnmatch.h>
10+
#ifndef __sun
11+
# include <fnmatch.h>
12+
# define p_fnmatch(p, s, f) fnmatch(p, s, f)
13+
#else
14+
# include "compat/fnmatch.h"
15+
#endif
1116

1217
#define p_lstat(p,b) lstat(p,b)
1318
#define p_readlink(a, b, c) readlink(a, b, c)
@@ -16,7 +21,6 @@
1621
#define p_mkdir(p,m) mkdir(p, m)
1722
#define p_fsync(fd) fsync(fd)
1823
#define p_realpath(p, po) realpath(p, po)
19-
#define p_fnmatch(p, s, f) fnmatch(p, s, f)
2024
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
2125
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
2226
#define p_mkstemp(p) mkstemp(p)

src/win32/posix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define INCLUDE_posix__w32_h__
99

1010
#include "common.h"
11-
#include "fnmatch.h"
11+
#include "compat/fnmatch.h"
1212
#include "utf-conv.h"
1313

1414
GIT_INLINE(int) p_link(const char *old, const char *new)

0 commit comments

Comments
 (0)