mirror of git://sourceware.org/git/glibc.git
Break __scandir_cancel_handler out into its own file.
This commit is contained in:
parent
b88a18e10c
commit
83c1089325
|
@ -1,5 +1,13 @@
|
||||||
2015-05-13 Roland McGrath <roland@hack.frob.com>
|
2015-05-13 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* dirent/scandirat.c (__scandir_cancel_handler): Function moved ...
|
||||||
|
* dirent/scandir-cancel.c: ... to this new file.
|
||||||
|
* dirent/Makefile (routines): Add it.
|
||||||
|
* dirent/scandirat64.c (SKIP_SCANDIR_CANCEL): Macro removed.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/scandir64.c
|
||||||
|
(SKIP_SCANDIR_CANCEL): Macro removed.
|
||||||
|
* include/dirent.h (__scandir_cancel_handler): Add attribute_hidden.
|
||||||
|
|
||||||
* dirent/tst-scandir.c: New file.
|
* dirent/tst-scandir.c: New file.
|
||||||
* dirent/tst-scandir64.c: New file.
|
* dirent/tst-scandir64.c: New file.
|
||||||
* dirent/Makefile (tests): Add them.
|
* dirent/Makefile (tests): Add them.
|
||||||
|
|
|
@ -27,7 +27,7 @@ routines := opendir closedir readdir readdir_r rewinddir \
|
||||||
seekdir telldir scandir alphasort versionsort \
|
seekdir telldir scandir alphasort versionsort \
|
||||||
getdents getdents64 dirfd readdir64 readdir64_r scandir64 \
|
getdents getdents64 dirfd readdir64 readdir64_r scandir64 \
|
||||||
alphasort64 versionsort64 fdopendir \
|
alphasort64 versionsort64 fdopendir \
|
||||||
scandirat scandirat64
|
scandirat scandirat64 scandir-cancel
|
||||||
|
|
||||||
tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \
|
tests := list tst-seekdir opendir-tst1 bug-readdir1 tst-fdopendir \
|
||||||
tst-fdopendir2 tst-scandir tst-scandir64
|
tst-fdopendir2 tst-scandir tst-scandir64
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -36,21 +36,6 @@
|
||||||
# define SCANDIRAT_WEAK_ALIAS
|
# define SCANDIRAT_WEAK_ALIAS
|
||||||
#endif
|
#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
|
int
|
||||||
SCANDIRAT (dfd, dir, namelist, select, cmp)
|
SCANDIRAT (dfd, dir, namelist, select, cmp)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#define SCANDIRAT scandirat64
|
#define SCANDIRAT scandirat64
|
||||||
#define READDIR __readdir64
|
#define READDIR __readdir64
|
||||||
#define DIRENT_TYPE struct dirent64
|
#define DIRENT_TYPE struct dirent64
|
||||||
#define SKIP_SCANDIR_CANCEL 1
|
|
||||||
|
|
||||||
#include "scandirat.c"
|
#include "scandirat.c"
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,10 @@ extern int __versionsort64 (const struct dirent64 **a,
|
||||||
extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
|
extern DIR *__alloc_dir (int fd, bool close_fd, int flags,
|
||||||
const struct stat64 *statp)
|
const struct stat64 *statp)
|
||||||
internal_function;
|
internal_function;
|
||||||
extern void __scandir_cancel_handler (void *arg);
|
|
||||||
extern __typeof (rewinddir) __rewinddir;
|
extern __typeof (rewinddir) __rewinddir;
|
||||||
|
|
||||||
|
extern void __scandir_cancel_handler (void *arg) attribute_hidden;
|
||||||
|
|
||||||
libc_hidden_proto (__rewinddir)
|
libc_hidden_proto (__rewinddir)
|
||||||
extern __typeof (scandirat) __scandirat;
|
extern __typeof (scandirat) __scandirat;
|
||||||
libc_hidden_proto (__scandirat)
|
libc_hidden_proto (__scandirat)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#define SCANDIRAT scandirat64
|
#define SCANDIRAT scandirat64
|
||||||
#define READDIR __readdir64
|
#define READDIR __readdir64
|
||||||
#define DIRENT_TYPE struct dirent64
|
#define DIRENT_TYPE struct dirent64
|
||||||
#define SKIP_SCANDIR_CANCEL 1
|
|
||||||
|
|
||||||
#include <dirent/scandir.c>
|
#include <dirent/scandir.c>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue