summaryrefslogtreecommitdiff
path: root/win32/readdir.c
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2000-05-24 14:46:13 +0000
committerSascha Schumann <sas@php.net>2000-05-24 14:46:13 +0000
commit8a86e37d69993ba8aa6c670d21cc0572f19e6da7 (patch)
tree825caf5ee423b884a52cf64706ce1a75655100d2 /win32/readdir.c
parentfaf4f764b72ba3b71fef601c70ee3de6165f693f (diff)
downloadphp-git-8a86e37d69993ba8aa6c670d21cc0572f19e6da7.tar.gz
The behaviour for result == NULL || entry == NULL is undefined.
Diffstat (limited to 'win32/readdir.c')
-rw-r--r--win32/readdir.c12
1 files changed, 4 insertions, 8 deletions
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;
}