summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-05-12 17:50:12 +0200
committerGeorge Peter Banyard <girgias@php.net>2020-05-12 22:01:20 +0200
commit8e66d22f7ee6526c916ba51ce24269cde8bba19a (patch)
tree757e56fb6956734f81a81b9961c325b439711130 /main/streams/plain_wrapper.c
parent1df3f97c215bab21a6dd14a9c2e564dc2dbc3123 (diff)
downloadphp-git-8e66d22f7ee6526c916ba51ce24269cde8bba19a.tar.gz
Fix [-Wundef] warning in streams implementation
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 2e9a17f040..edde4121b8 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -133,11 +133,11 @@ typedef struct {
int lock_flag; /* stores the lock state */
zend_string *temp_name; /* if non-null, this is the path to a temporary file that
* is to be deleted when the stream is closed */
-#if HAVE_FLUSHIO
+#ifdef HAVE_FLUSHIO
char last_op;
#endif
-#if HAVE_MMAP
+#ifdef HAVE_MMAP
char *last_mapped_addr;
size_t last_mapped_len;
#endif
@@ -358,7 +358,7 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun
return bytes_written;
} else {
-#if HAVE_FLUSHIO
+#ifdef HAVE_FLUSHIO
if (data->is_seekable && data->last_op == 'r') {
zend_fseek(data->file, 0, SEEK_CUR);
}
@@ -433,7 +433,7 @@ static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
}
} else {
-#if HAVE_FLUSHIO
+#ifdef HAVE_FLUSHIO
if (data->is_seekable && data->last_op == 'w')
zend_fseek(data->file, 0, SEEK_CUR);
data->last_op = 'r';
@@ -453,7 +453,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle)
assert(data != NULL);
-#if HAVE_MMAP
+#ifdef HAVE_MMAP
if (data->last_mapped_addr) {
munmap(data->last_mapped_addr, data->last_mapped_len);
data->last_mapped_addr = NULL;
@@ -475,7 +475,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle)
errno = 0;
ret = pclose(data->file);
-#if HAVE_SYS_WAIT_H
+#ifdef HAVE_SYS_WAIT_H
if (WIFEXITED(ret)) {
ret = WEXITSTATUS(ret);
}
@@ -704,7 +704,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
break;
case PHP_STREAM_OPTION_MMAP_API:
-#if HAVE_MMAP
+#ifdef HAVE_MMAP
{
php_stream_mmap_range *range = (php_stream_mmap_range*)ptrparam;
int prot, flags;
@@ -882,7 +882,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
return PHP_STREAM_OPTION_RETURN_ERR;
}
-#if defined(_WIN64)
+#ifdef _WIN64
sz.QuadPart = new_size;
#else
sz.HighPart = 0;
@@ -1226,7 +1226,7 @@ static int php_plain_files_rename(php_stream_wrapper *wrapper, const char *url_f
if (php_copy_file(url_from, url_to) == SUCCESS) {
if (VCWD_STAT(url_from, &sb) == 0) {
success = 1;
-# if !defined(TSRM_WIN32)
+# ifndef TSRM_WIN32
/*
* Try to set user and permission info on the target.
* If we're not root, then some of these may fail.