Skip to content

Commit dc07daf

Browse files
committed
backport zend_stat usage
1 parent 708fd96 commit dc07daf

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

win32/glob.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,25 +161,25 @@ struct glob_lim {
161161

162162
struct glob_path_stat {
163163
char *gps_path;
164-
struct stat *gps_stat;
164+
zend_stat stat *gps_stat;
165165
};
166166

167167
static int compare(const void *, const void *);
168168
static int compare_gps(const void *, const void *);
169169
static int g_Ctoc(const Char *, char *, size_t);
170-
static int g_lstat(Char *, struct stat *, glob_t *);
170+
static int g_lstat(Char *, zend_stat *, glob_t *);
171171
static DIR *g_opendir(Char *, glob_t *);
172172
static Char *g_strchr(const Char *, int);
173173
static int g_strncmp(const Char *, const char *, size_t);
174-
static int g_stat(Char *, struct stat *, glob_t *);
174+
static int g_stat(Char *, zend_stat *, glob_t *);
175175
static int glob0(const Char *, glob_t *, struct glob_lim *);
176176
static int glob1(Char *, Char *, glob_t *, struct glob_lim *);
177177
static int glob2(Char *, Char *, Char *, Char *, Char *, Char *,
178178
glob_t *, struct glob_lim *);
179179
static int glob3(Char *, Char *, Char *, Char *, Char *,
180180
Char *, Char *, glob_t *, struct glob_lim *);
181181
static int globextend(const Char *, glob_t *, struct glob_lim *,
182-
struct stat *);
182+
zend_stat *);
183183
static const Char *
184184
globtilde(const Char *, Char *, size_t, glob_t *);
185185
static int globexp1(const Char *, glob_t *, struct glob_lim *);
@@ -663,7 +663,7 @@ static int
663663
glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
664664
Char *pattern, Char *pattern_last, glob_t *pglob, struct glob_lim *limitp)
665665
{
666-
struct stat sb;
666+
zend_stat sb;
667667
Char *p, *q;
668668
int anymeta;
669669

@@ -829,13 +829,13 @@ glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
829829
*/
830830
static int
831831
globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
832-
struct stat *sb)
832+
zend_stat *sb)
833833
{
834834
char **pathv;
835835
size_t i, newn, len;
836836
char *copy = NULL;
837837
const Char *p;
838-
struct stat **statv;
838+
zend_stat **statv;
839839

840840
newn = 2 + pglob->gl_pathc + pglob->gl_offs;
841841
if (pglob->gl_offs >= SSIZE_MAX ||
@@ -1043,27 +1043,27 @@ g_opendir(Char *str, glob_t *pglob)
10431043
}
10441044

10451045
static int
1046-
g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
1046+
g_lstat(Char *fn, zend_stat *sb, glob_t *pglob)
10471047
{
10481048
char buf[PATH_MAX];
10491049

10501050
if (g_Ctoc(fn, buf, sizeof(buf)))
10511051
return(-1);
10521052
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
10531053
return((*pglob->gl_lstat)(buf, sb));
1054-
return(lstat(buf, sb));
1054+
return(php_sys_lstat(buf, sb));
10551055
}
10561056

10571057
static int
1058-
g_stat(Char *fn, struct stat *sb, glob_t *pglob)
1058+
g_stat(Char *fn, zend_stat *sb, glob_t *pglob)
10591059
{
10601060
char buf[PATH_MAX];
10611061

10621062
if (g_Ctoc(fn, buf, sizeof(buf)))
10631063
return(-1);
10641064
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
10651065
return((*pglob->gl_stat)(buf, sb));
1066-
return(stat(buf, sb));
1066+
return(php_sys_stat(buf, sb));
10671067
}
10681068

10691069
static Char *

win32/glob.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,19 @@
3838
#ifndef _GLOB_H_
3939
#define _GLOB_H_
4040

41-
#include <sys/stat.h>
42-
4341
#ifndef PHP_WIN32
4442
# include <sys/cdefs.h>
4543
#endif
4644

4745
#include "Zend/zend_stream.h"
4846

49-
struct stat;
5047
typedef struct {
5148
size_t gl_pathc; /* Count of total paths so far. */
5249
size_t gl_matchc; /* Count of paths matching pattern. */
5350
size_t gl_offs; /* Reserved at beginning of gl_pathv. */
5451
int gl_flags; /* Copy of flags parameter to glob. */
5552
char **gl_pathv; /* List of paths matching pattern. */
56-
struct stat **gl_statv; /* Stat entries corresponding to gl_pathv */
53+
zend_stat **gl_statv; /* Stat entries corresponding to gl_pathv */
5754
/* Copy of errfunc parameter to glob. */
5855
int (*gl_errfunc)(const char *, int);
5956

@@ -65,8 +62,8 @@ typedef struct {
6562
void (*gl_closedir)(void *);
6663
struct dirent *(*gl_readdir)(void *);
6764
void *(*gl_opendir)(const char *);
68-
int (*gl_lstat)(const char *, struct stat *);
69-
int (*gl_stat)(const char *, struct stat *);
65+
int (*gl_lstat)(const char *, zend_stat *);
66+
int (*gl_stat)(const char *, zend_stat *);
7067
} glob_t;
7168

7269
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */

0 commit comments

Comments
 (0)