summaryrefslogtreecommitdiff
path: root/win32/readdir.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-11 14:25:40 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-04-11 16:52:36 +0200
commit2b28f7189144a21e753dbc09efadd571121a82b9 (patch)
treeb40f387f5be293dde192f2743d14323160669128 /win32/readdir.c
parent3e0f9c2c94d1511eaf30f8f1de8260f5821c985f (diff)
downloadphp-git-2b28f7189144a21e753dbc09efadd571121a82b9.tar.gz
Use readdir() instead of readdir_r()
readdir_r() is deprecated in modern glibc versions. readdir() is thread safe in practice, as long as there are no concurrent accesses on the *same* directory stream.
Diffstat (limited to 'win32/readdir.c')
-rw-r--r--win32/readdir.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/win32/readdir.c b/win32/readdir.c
index b4d5e3afae..c172f16fc2 100644
--- a/win32/readdir.c
+++ b/win32/readdir.c
@@ -127,46 +127,6 @@ struct dirent *readdir(DIR *dp)
return &(dp->dent);
}/*}}}*/
-int readdir_r(DIR *dp, struct dirent *entry, struct dirent **result)
-{/*{{{*/
- char *_tmp;
- size_t reclen;
-
- if (!dp || dp->finished) {
- *result = NULL;
- return 0;
- }
-
- if (dp->offset != 0) {
- if (FindNextFileW(dp->handle, &(dp->fileinfo)) == 0) {
- dp->finished = 1;
- *result = NULL;
- return 0;
- }
- }
-
- _tmp = php_win32_cp_conv_w_to_any(dp->fileinfo.cFileName, PHP_WIN32_CP_IGNORE_LEN, &reclen);
- if (!_tmp) {
- /* wide to utf8 failed, should never happen. */
- result = NULL;
- return 0;
- }
- memmove(dp->dent.d_name, _tmp, reclen + 1);
- free(_tmp);
- dp->dent.d_reclen = (unsigned short)reclen;
-
- dp->offset++;
-
- dp->dent.d_ino = 1;
- dp->dent.d_off = dp->offset;
-
- memcpy(entry, &dp->dent, sizeof(*entry));
-
- *result = &dp->dent;
-
- return 0;
-}/*}}}*/
-
int closedir(DIR *dp)
{/*{{{*/
if (!dp)