cvs: php4 / reentrancy.c /win32/ readdir.c
[email protected] ("Sascha Schumann")
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <cvssas959179574@cvsserver> |
sas Wed May 24 16:46:14 2000 EDT
Modified files:
/php4 reentrancy.c
/php4/win32 readdir.c
Log:
The behaviour for result == NULL || entry == NULL is undefined.
Index: php4/reentrancy.c
diff -u php4/reentrancy.c:1.19 php4/reentrancy.c:1.20
--- php4/reentrancy.c:1.19 Wed May 24 16:41:28 2000
+++ php4/reentrancy.c Wed May 24 16:46:13 2000
@@ -127,11 +127,10 @@
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);
Index: php4/win32/readdir.c
diff -u php4/win32/readdir.c:1.3 php4/win32/readdir.c:1.4
--- php4/win32/readdir.c:1.3 Tue May 23 16:58:43 2000
+++ php4/win32/readdir.c Wed May 24 16:46:13 2000
@@ -74,16 +74,14 @@
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 @@
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;
}