mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 02:40:08 +00:00
f17a42333f
sys/cdefs.h has a macro __ptr_t, which a few places in glibc use instead of void *. void * is a well-understood standard type for that purpose and in a post-C89 context there is no need for a macro for it; this patch changes those places to use void * directly instead. Unlike __long_double_t, __ptr_t is widely used outside glibc (or at least has many hits on codesearch.debian.net). I don't know how many of those uses would break if sys/cdefs.h ceased to define the macro, but there's enough risk that this patch leaves the definition and just removes the uses within glibc; removal of the definition can be considered separately if desired. Tested for x86_64, and with build-many-glibcs.py. * malloc/mcheck.c (old_free_hook): Use void * instead of __ptr_t. (old_malloc_hook): Likewise. (old_memalign_hook): Likewise. (old_realloc_hook): Likewise. (struct hdr): Likewise. (flood): Likewise. (freehook): Likewise. (mallochook): Likewise. (memalignhook): Likewise. (reallochook): Likewise. (mprobe): Likewise. * malloc/mtrace.c (mallwatch): Likewise. (tr_old_free_hook): Likewise. (tr_old_malloc_hook): Likewise. (tr_old_realloc_hook): Likewise. (tr_old_memalign_hook): Likewise. (tr_where): Likewise. (lock_and_info): Likewise. (tr_freehook): Likewise. (tr_mallochook): Likewise. (tr_reallochook): Likewise. (tr_memalignhook): Likewise. * misc/err.h [!__GNUC_VA_LIST] (__gnuc_va_list): Likewise. * misc/mmap.c (__mmap): Likewise. * misc/mmap64.c (__mmap64): Likewise. * misc/mprotect.c (__mprotect): Likewise. * misc/msync.c (msync): Likewise. * misc/munmap.c (__munmap): Likewise. * posix/posix_madvise.c (posix_madvise): Likewise. * socket/send.c (__send): Likewise. * socket/sendto.c (__sendto): Likewise. * socket/setsockopt.c (__setsockopt): Likewise. * string/memcmp.c (__ptr_t): Remove macro. (MEMCMP): Use void * instead of ptr_t. * string/memrchr.c (__ptr_t): Remove macro. (__memrchr): Use void * instead of ptr_t. * sysdeps/mach/hurd/dl-sysdep.c (__mmap): Likewise. * sysdeps/mach/hurd/mmap.c (__mmap): Likewise. * sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise. * sysdeps/mach/mprotect.c (__mprotect): Likewise. * sysdeps/mach/msync.c (msync): Likewise. * sysdeps/mach/munmap.c (__munmap): Likewise. * sysdeps/mips/bits/setjmp.h (struct __jmp_buf_internal_tag): Likewise. * sysdeps/posix/getcwd.c (__getcwd): Likewise. * sysdeps/powerpc/powerpc32/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc32/power4/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc32/power4/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc32/power6/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc32/power6/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc32/power7/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc32/power7/mempcpy.S (__mempcpy): Likewise. * sysdeps/powerpc/powerpc32/power7/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc64/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc64/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc64/power4/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc64/power4/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc64/power6/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc64/power6/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc64/power7/memcpy.S (memcpy): Likewise. * sysdeps/powerpc/powerpc64/power7/mempcpy.S (__mempcpy): Likewise. * sysdeps/powerpc/powerpc64/power7/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc64/power8/memset.S (memset): Likewise. * sysdeps/tile/memcmp.c (__ptr_t): Remove macro. (MEMCMP): Use void * instead of ptr_t. * sysdeps/unix/sysv/linux/alpha/oldglob.c (old_glob_t): Likewise. * sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
100 lines
3.2 KiB
C
100 lines
3.2 KiB
C
/* Copyright (C) 1998-2017 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/>. */
|
|
|
|
/* This file contains only wrappers around the real glob functions. It
|
|
became necessary since the glob_t structure changed. */
|
|
#include <sys/types.h>
|
|
#include <glob.h>
|
|
#include <shlib-compat.h>
|
|
|
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
|
|
|
|
/* This is the old structure. The difference is that the gl_pathc and
|
|
gl_offs elements have type `int'. */
|
|
typedef struct
|
|
{
|
|
int gl_pathc; /* Count of paths matched by the pattern. */
|
|
char **gl_pathv; /* List of matched pathnames. */
|
|
int gl_offs; /* Slots to reserve in `gl_pathv'. */
|
|
int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
|
|
|
|
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
|
|
are used instead of the normal file access functions. */
|
|
void (*gl_closedir) (void *);
|
|
struct dirent *(*gl_readdir) (void *);
|
|
void *(*gl_opendir) (const char *);
|
|
int (*gl_lstat) (const char *, struct stat *);
|
|
int (*gl_stat) (const char *, struct stat *);
|
|
} old_glob_t;
|
|
|
|
|
|
int
|
|
attribute_compat_text_section
|
|
__old_glob (const char *pattern, int flags,
|
|
int (*errfunc) (const char *, int),
|
|
old_glob_t *pglob)
|
|
{
|
|
glob_t correct;
|
|
int result;
|
|
|
|
/* Construct an object of correct type. */
|
|
correct.gl_pathc = pglob->gl_pathc;
|
|
correct.gl_pathv = pglob->gl_pathv;
|
|
correct.gl_offs = pglob->gl_offs;
|
|
correct.gl_flags = pglob->gl_flags;
|
|
correct.gl_closedir = pglob->gl_closedir;
|
|
correct.gl_readdir = pglob->gl_readdir;
|
|
correct.gl_opendir = pglob->gl_opendir;
|
|
correct.gl_lstat = pglob->gl_lstat;
|
|
correct.gl_stat = pglob->gl_stat;
|
|
|
|
result = glob (pattern, flags, errfunc, &correct);
|
|
|
|
/* And convert it back. */
|
|
pglob->gl_pathc = correct.gl_pathc;
|
|
pglob->gl_pathv = correct.gl_pathv;
|
|
pglob->gl_offs = correct.gl_offs;
|
|
pglob->gl_flags = correct.gl_flags;
|
|
pglob->gl_closedir = correct.gl_closedir;
|
|
pglob->gl_readdir = correct.gl_readdir;
|
|
pglob->gl_opendir = correct.gl_opendir;
|
|
pglob->gl_lstat = correct.gl_lstat;
|
|
pglob->gl_stat = correct.gl_stat;
|
|
|
|
return result;
|
|
}
|
|
compat_symbol (libc, __old_glob, glob, GLIBC_2_0);
|
|
|
|
|
|
/* Free storage allocated in PGLOB by a previous `glob' call. */
|
|
void
|
|
attribute_compat_text_section
|
|
__old_globfree (old_glob_t *pglob)
|
|
{
|
|
glob_t correct;
|
|
|
|
/* We only need these two symbols. */
|
|
correct.gl_pathc = pglob->gl_pathc;
|
|
correct.gl_pathv = pglob->gl_pathv;
|
|
correct.gl_offs = pglob->gl_offs;
|
|
|
|
globfree (&correct);
|
|
}
|
|
compat_symbol (libc, __old_globfree, globfree, GLIBC_2_0);
|
|
|
|
#endif
|