summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/reentrancy.c5
-rw-r--r--win32/readdir.c12
2 files changed, 6 insertions, 11 deletions
diff --git a/main/reentrancy.c b/main/reentrancy.c
index 4677d52ea2..866cf4273e 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.c
@@ -127,11 +127,10 @@ PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,
if (!ptr && errno != 0)
ret = errno;
- if (entry && ptr)
+ if (ptr)
memcpy(entry, ptr, sizeof(*ptr));
- if (result)
- *result = ptr;
+ *result = ptr;
local_unlock(READDIR_R);
diff --git a/win32/readdir.c b/win32/readdir.c
index a9cfa3a513..ed799a6747 100644
--- a/win32/readdir.c
+++ b/win32/readdir.c
@@ -74,16 +74,14 @@ struct dirent *readdir(DIR *dp)
int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result)
{
if (!dp || dp->finished) {
- if (result)
- *result = NULL;
+ *result = NULL;
return 0;
}
if (dp->offset != 0) {
if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
dp->finished = 1;
- if (result)
- *result = NULL;
+ *result = NULL;
return 0;
}
}
@@ -94,11 +92,9 @@ int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result)
dp->dent.d_reclen = strlen(dp->dent.d_name);
dp->dent.d_off = dp->offset;
- if (entry)
- memcpy(entry, &dp->dent, sizeof(*entry));
+ memcpy(entry, &dp->dent, sizeof(*entry));
- if (result)
- *result = &dp->dent;
+ *result = &dp->dent;
return 0;
}