summaryrefslogtreecommitdiff
path: root/dirent
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2015-05-13 12:33:56 -0700
committerRoland McGrath <roland@hack.frob.com>2015-05-13 12:33:56 -0700
commit83c10893259916152d277327fa37d8f70bb4d4c2 (patch)
treec7076c7a35593a2cb883c9af2ee40bae88e22af4 /dirent
parentb88a18e10c9b18a74e2c2b26817189a5841cff12 (diff)
downloadglibc-83c10893259916152d277327fa37d8f70bb4d4c2.tar.gz
Break __scandir_cancel_handler out into its own file.
Diffstat (limited to 'dirent')
-rw-r--r--dirent/Makefile2
-rw-r--r--dirent/scandir-cancel.c31
-rw-r--r--dirent/scandirat.c15
-rw-r--r--dirent/scandirat64.c1
4 files changed, 32 insertions, 17 deletions
diff --git a/dirent/Makefile b/dirent/Makefile
index 3c71ccfa7c..2a97649c04 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -27,7 +27,7 @@ routines := opendir closedir readdir readdir_r rewinddir \
seekdir telldir scandir alphasort versionsort \
getdents getdents64 dirfd readdir64 readdir64_r scandir64 \
alphasort64 versionsort64 fdopendir \
- scandirat scandirat64
+ scandirat scandirat64 scandir-cancel
tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \
tst-fdopendir2 tst-scandir tst-scandir64
diff --git a/dirent/scandir-cancel.c b/dirent/scandir-cancel.c
new file mode 100644
index 0000000000..549a4f81a7
--- /dev/null
+++ b/dirent/scandir-cancel.c
@@ -0,0 +1,31 @@
+/* Cancellation handler used in scandir* implementations.
+ Copyright (C) 1992-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <dirent.h>
+
+void
+__scandir_cancel_handler (void *arg)
+{
+ struct scandir_cancel_struct *cp = arg;
+ void **v = cp->v;
+
+ for (size_t i = 0; i < cp->cnt; ++i)
+ free (v[i]);
+ free (v);
+ (void) __closedir (cp->dp);
+}
diff --git a/dirent/scandirat.c b/dirent/scandirat.c
index 004b1527f3..d7ae5e52c8 100644
--- a/dirent/scandirat.c
+++ b/dirent/scandirat.c
@@ -36,21 +36,6 @@
# define SCANDIRAT_WEAK_ALIAS
#endif
-#ifndef SKIP_SCANDIR_CANCEL
-void
-__scandir_cancel_handler (void *arg)
-{
- struct scandir_cancel_struct *cp = arg;
- size_t i;
- void **v = cp->v;
-
- for (i = 0; i < cp->cnt; ++i)
- free (v[i]);
- free (v);
- (void) __closedir (cp->dp);
-}
-#endif
-
int
SCANDIRAT (dfd, dir, namelist, select, cmp)
diff --git a/dirent/scandirat64.c b/dirent/scandirat64.c
index c9a6186f9a..fcdd1a9a73 100644
--- a/dirent/scandirat64.c
+++ b/dirent/scandirat64.c
@@ -23,7 +23,6 @@
#define SCANDIRAT scandirat64
#define READDIR __readdir64
#define DIRENT_TYPE struct dirent64
-#define SKIP_SCANDIR_CANCEL 1
#include "scandirat.c"