Skip to content

Commit c444c41

Browse files
committed
further cleanups with S_IF* macros generalized declarations
1 parent cfadcfc commit c444c41

File tree

8 files changed

+11
-31
lines changed

8 files changed

+11
-31
lines changed

Zend/zend_virtual_cwd.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ cwd_state main_cwd_state; /* True global */
8989
#include <direct.h>
9090
#endif
9191

92-
#ifndef S_ISDIR
93-
#define S_ISDIR(mode) ((mode) & _S_IFDIR)
94-
#endif
95-
96-
#ifndef S_ISREG
97-
#define S_ISREG(mode) ((mode) & _S_IFREG)
98-
#endif
99-
10092
#ifdef TSRM_WIN32
10193
#include <tchar.h>
10294
#define tsrm_strtok_r(a,b,c) _tcstok((a),(b))

Zend/zend_virtual_cwd.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,15 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
337337

338338
#endif
339339

340+
/* Global stat declarations */
341+
#ifndef _S_IFDIR
342+
#define _S_IFDIR S_IFDIR
343+
#endif
344+
345+
#ifndef _S_IFREG
346+
#define _S_IFREG S_IFREG
347+
#endif
348+
340349
#ifndef S_ISDIR
341350
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
342351
#endif
@@ -349,6 +358,8 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void);
349358
#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK)
350359
#endif
351360

361+
#ifndef S_IXROOT
352362
#define S_IXROOT ( S_IXUSR | S_IXGRP | S_IXOTH )
363+
#endif
353364

354365
#endif /* VIRTUAL_CWD_H */

ext/fileinfo/fileinfo.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939
#include "fopen_wrappers.h" /* needed for is_url */
4040
#include "Zend/zend_exceptions.h"
4141

42-
#ifndef _S_IFDIR
43-
# define _S_IFDIR S_IFDIR
44-
#endif
45-
4642
/* {{{ macros and type definitions */
4743
typedef struct _php_fileinfo {
4844
zend_long options;

main/fopen_wrappers.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
#include <sys/socket.h>
5454
#endif
5555

56-
#ifndef S_ISREG
57-
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
58-
#endif
59-
6056
#ifdef PHP_WIN32
6157
#include <winsock2.h>
6258
#elif defined(NETWARE) && defined(USE_WINSOCK)

main/main.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@
114114
#endif
115115
/* }}} */
116116

117-
#ifndef S_ISREG
118-
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
119-
#endif
120-
121117
PHPAPI int (*php_register_internal_extensions_func)(void) = php_register_internal_extensions;
122118

123119
#ifndef ZTS

main/php_ini.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#include <dirent.h>
3838
#endif
3939

40-
#ifndef S_ISREG
41-
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
42-
#endif
43-
4440
#ifdef PHP_WIN32
4541
#define TRANSLATE_SLASHES_LOWER(path) \
4642
{ \

main/streams/php_streams_int.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
# define EWOULDBLOCK WSAEWOULDBLOCK
5656
#endif
5757

58-
#ifndef S_ISREG
59-
#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
60-
#endif
61-
6258
/* This functions transforms the first char to 'w' if it's not 'r', 'a' or 'w'
6359
* and strips any subsequent chars except '+' and 'b'.
6460
* Use this to sanitize stream->mode if you call e.g. fdopen, fopencookie or

main/win95nt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ typedef char * caddr_t;
4040
#define S_IFIFO _IFIFO
4141
#define S_IFBLK _IFBLK
4242
#define S_IFLNK _IFLNK
43-
#ifndef S_ISREG
44-
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
45-
#endif
4643
#define chdir(path) _chdir(path)
4744
#define mkdir(a, b) _mkdir(a)
4845
#define rmdir(a) _rmdir(a)

0 commit comments

Comments
 (0)