Skip to content

Commit 4338feb

Browse files
committed
Move glob to main/ from win32/
In preparation to make the Win32 reimplementation the standard cross-platform one. Currently, it doesn't do that and just passes through the original glob implementation. We could consider also having an option to use the standard glob for systems that have a sufficient one.
1 parent a519a03 commit 4338feb

File tree

11 files changed

+18
-39
lines changed

11 files changed

+18
-39
lines changed

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ PHP_ADD_SOURCES([main], m4_normalize([
16311631
php_content_types.c
16321632
php_ini_builder.c
16331633
php_ini.c
1634+
php_glob.c
16341635
php_odbc_utils.c
16351636
php_open_temporary_file.c
16361637
php_scandir.c

ext/ffi/ffi.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@
4545
#endif
4646
#endif
4747

48-
#ifdef HAVE_GLOB
49-
#ifdef PHP_WIN32
50-
#include "win32/glob.h"
51-
#else
52-
#include <glob.h>
53-
#endif
54-
#endif
48+
#include "php_glob.h"
5549

5650
#ifndef __BIGGEST_ALIGNMENT__
5751
/* XXX need something better, perhaps with regard to SIMD, etc. */

ext/opcache/zend_accelerator_blacklist.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@
3030
# define REGEX_MODE (REG_EXTENDED|REG_NOSUB)
3131
#endif
3232

33-
#ifdef HAVE_GLOB
34-
#ifdef PHP_WIN32
35-
#include "win32/glob.h"
36-
#else
37-
#include <glob.h>
38-
#endif
39-
#endif
33+
#include "php_glob.h"
4034

4135
#include "ext/pcre/php_pcre.h"
4236

ext/standard/php_dir_int.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@
1717
#ifndef PHP_DIR_INT_H
1818
#define PHP_DIR_INT_H
1919

20-
#ifdef HAVE_GLOB
21-
#ifndef PHP_WIN32
22-
#include <glob.h>
23-
#else
24-
#include "win32/glob.h"
25-
#endif
26-
#endif
20+
#include "php_glob.h"
2721

2822
#ifdef HAVE_GLOB
2923

ext/zip/php_zip.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@
3030
#include "php_zip.h"
3131
#include "php_zip_arginfo.h"
3232

33-
#ifdef HAVE_GLOB
34-
#ifndef PHP_WIN32
35-
#include <glob.h>
36-
#else
37-
#include "win32/glob.h"
38-
#endif
39-
#endif
33+
#include "php_glob.h"
4034

4135
/* {{{ Resource le */
4236
static int le_zip_dir;
File renamed without changes.

win32/glob.c renamed to main/php_glob.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
* Number of matches in the current invocation of glob.
5656
*/
5757

58+
#if defined(HAVE_GLOB)
59+
5860
#ifdef PHP_WIN32
5961
#if _MSC_VER < 1800
6062
# define _POSIX_
@@ -1120,3 +1122,5 @@ static void qprintf(const char *str, Char *s)
11201122
(void)printf("\n");
11211123
}
11221124
#endif
1125+
1126+
#endif /* defined(HAVE_GLOB) */

win32/glob.h renamed to main/php_glob.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
* @(#)glob.h 8.1 (Berkeley) 6/2/93
3636
*/
3737

38+
#if defined(HAVE_GLOB)
39+
#include <glob.h>
40+
#else
41+
3842
#ifndef _GLOB_H_
3943
#define _GLOB_H_
4044

@@ -98,3 +102,5 @@ PHPAPI void globfree(glob_t *);
98102
END_EXTERN_C()
99103

100104
#endif /* !_GLOB_H_ */
105+
106+
#endif /* defined(HAVE_GLOB) */

main/streams/glob_wrapper.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@
1717
#include "php.h"
1818
#include "php_streams_int.h"
1919

20-
#ifdef HAVE_GLOB
21-
# ifndef PHP_WIN32
22-
# include <glob.h>
23-
# else
24-
# include "win32/glob.h"
25-
# endif
26-
#endif
20+
#include "php_glob.h"
2721

2822
#ifdef HAVE_GLOB
2923
#ifndef GLOB_ONLYDIR

sapi/fpm/fpm/fpm_conf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
#include <stddef.h>
1111
#include <string.h>
1212
#include <inttypes.h>
13-
#ifdef HAVE_GLOB
14-
# include <glob.h>
15-
#endif
13+
#include "php_glob.h"
1614

1715
#include <stdio.h>
1816
#include <unistd.h>

win32/build/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ if (VS_TOOLSET && VCVERS >= 1914) {
305305
ADD_FLAG("CFLAGS_BD_MAIN_STREAMS", "/d2FuncCache1");
306306
}
307307

308-
ADD_SOURCES("win32", "dllmain.c glob.c readdir.c \
308+
ADD_SOURCES("win32", "dllmain.c readdir.c \
309309
registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c \
310310
getrusage.c ftok.c ioutil.c codepage.c nice.c \
311311
fnmatch.c sockets.c console.c signal.c");

0 commit comments

Comments
 (0)