Skip to content

Commit 48fbd32

Browse files
committed
Update OpenBSD glob implementation for Windows
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. This also adds a new internal header (charclass.h) for glob. See conversation in phpGH-15564.
1 parent 7f56e42 commit 48fbd32

File tree

4 files changed

+438
-169
lines changed

4 files changed

+438
-169
lines changed

main/php.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ PHPAPI void *php_reallocarray(void *optr, size_t nmemb, size_t size);
178178
END_EXTERN_C()
179179
#undef reallocarray
180180
#define reallocarray php_reallocarray
181+
#define HAVE_REALLOCARRAY 1
182+
#define USE_REALLOCARRAY_PHP_IMPL 1
181183
#endif
182184

183185
BEGIN_EXTERN_C()

win32/charclass.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Public domain, 2008, Todd C. Miller <[email protected]>
3+
*
4+
* $OpenBSD: charclass.h,v 1.3 2020/10/13 04:42:28 guenther Exp $
5+
*/
6+
7+
/*
8+
* POSIX character class support for fnmatch() and glob().
9+
*/
10+
static const struct cclass {
11+
const char *name;
12+
int (*isctype)(int);
13+
} cclasses[] = {
14+
{ "alnum", isalnum },
15+
{ "alpha", isalpha },
16+
{ "blank", isblank },
17+
{ "cntrl", iscntrl },
18+
{ "digit", isdigit },
19+
{ "graph", isgraph },
20+
{ "lower", islower },
21+
{ "print", isprint },
22+
{ "punct", ispunct },
23+
{ "space", isspace },
24+
{ "upper", isupper },
25+
{ "xdigit", isxdigit },
26+
{ NULL, NULL }
27+
};
28+
29+
#define NCCLASSES (sizeof(cclasses) / sizeof(cclasses[0]) - 1)

0 commit comments

Comments
 (0)