Skip to content

Commit 8e66d22

Browse files
committed
Fix [-Wundef] warning in streams implementation
1 parent 1df3f97 commit 8e66d22

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

main/streams/plain_wrapper.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ typedef struct {
133133
int lock_flag; /* stores the lock state */
134134
zend_string *temp_name; /* if non-null, this is the path to a temporary file that
135135
* is to be deleted when the stream is closed */
136-
#if HAVE_FLUSHIO
136+
#ifdef HAVE_FLUSHIO
137137
char last_op;
138138
#endif
139139

140-
#if HAVE_MMAP
140+
#ifdef HAVE_MMAP
141141
char *last_mapped_addr;
142142
size_t last_mapped_len;
143143
#endif
@@ -358,7 +358,7 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun
358358
return bytes_written;
359359
} else {
360360

361-
#if HAVE_FLUSHIO
361+
#ifdef HAVE_FLUSHIO
362362
if (data->is_seekable && data->last_op == 'r') {
363363
zend_fseek(data->file, 0, SEEK_CUR);
364364
}
@@ -433,7 +433,7 @@ static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
433433
}
434434

435435
} else {
436-
#if HAVE_FLUSHIO
436+
#ifdef HAVE_FLUSHIO
437437
if (data->is_seekable && data->last_op == 'w')
438438
zend_fseek(data->file, 0, SEEK_CUR);
439439
data->last_op = 'r';
@@ -453,7 +453,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle)
453453

454454
assert(data != NULL);
455455

456-
#if HAVE_MMAP
456+
#ifdef HAVE_MMAP
457457
if (data->last_mapped_addr) {
458458
munmap(data->last_mapped_addr, data->last_mapped_len);
459459
data->last_mapped_addr = NULL;
@@ -475,7 +475,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle)
475475
errno = 0;
476476
ret = pclose(data->file);
477477

478-
#if HAVE_SYS_WAIT_H
478+
#ifdef HAVE_SYS_WAIT_H
479479
if (WIFEXITED(ret)) {
480480
ret = WEXITSTATUS(ret);
481481
}
@@ -704,7 +704,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
704704
break;
705705

706706
case PHP_STREAM_OPTION_MMAP_API:
707-
#if HAVE_MMAP
707+
#ifdef HAVE_MMAP
708708
{
709709
php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam;
710710
int prot, flags;
@@ -882,7 +882,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
882882
return PHP_STREAM_OPTION_RETURN_ERR;
883883
}
884884

885-
#if defined(_WIN64)
885+
#ifdef _WIN64
886886
sz.QuadPart = new_size;
887887
#else
888888
sz.HighPart = 0;
@@ -1226,7 +1226,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
12261226
if (php_copy_file(url_from, url_to) == SUCCESS) {
12271227
if (VCWD_STAT(url_from, &sb) == 0) {
12281228
success = 1;
1229-
# if !defined(TSRM_WIN32)
1229+
# ifndef TSRM_WIN32
12301230
/*
12311231
* Try to set user and permission info on the target.
12321232
* If we're not root, then some of these may fail.

main/streams/xp_socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# undef AF_UNIX
2424
#endif
2525

26-
#if defined(AF_UNIX)
26+
#ifdef AF_UNIX
2727
#include <sys/un.h>
2828
#endif
2929

@@ -237,7 +237,7 @@ static int php_sockop_flush(php_stream *stream)
237237

238238
static int php_sockop_stat(php_stream *stream, php_stream_statbuf *ssb)
239239
{
240-
#if ZEND_WIN32
240+
#ifdef ZEND_WIN32
241241
return 0;
242242
#else
243243
php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;

0 commit comments

Comments
 (0)