Do not use __ptr_t.

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.
This commit is contained in:
Joseph Myers 2017-08-08 17:14:49 +00:00
parent 0df595b23a
commit f17a42333f
44 changed files with 197 additions and 134 deletions

View File

@ -1,3 +1,75 @@
2017-08-08 Joseph Myers <joseph@codesourcery.com>
* 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.
2017-08-08 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Remove unreachable

View File

@ -28,12 +28,12 @@
#endif
/* Old hook values. */
static void (*old_free_hook)(__ptr_t ptr, const __ptr_t);
static __ptr_t (*old_malloc_hook) (size_t size, const __ptr_t);
static __ptr_t (*old_memalign_hook) (size_t alignment, size_t size,
const __ptr_t);
static __ptr_t (*old_realloc_hook) (__ptr_t ptr, size_t size,
const __ptr_t);
static void (*old_free_hook)(void *ptr, const void *);
static void *(*old_malloc_hook) (size_t size, const void *);
static void *(*old_memalign_hook) (size_t alignment, size_t size,
const void *);
static void *(*old_realloc_hook) (void *ptr, size_t size,
const void *);
/* Function to call when something awful happens. */
static void (*abortfunc) (enum mcheck_status);
@ -51,7 +51,7 @@ struct hdr
unsigned long int magic; /* Magic number to check header integrity. */
struct hdr *prev;
struct hdr *next;
__ptr_t block; /* Real block allocated, for memalign. */
void *block; /* Real block allocated, for memalign. */
unsigned long int magic2; /* Extra, keeps us doubleword aligned. */
};
@ -68,9 +68,9 @@ static int pedantic;
# include <string.h>
# define flood memset
#else
static void flood (__ptr_t, int, size_t);
static void flood (void *, int, size_t);
static void
flood (__ptr_t ptr, int val, size_t size)
flood (void *ptr, int val, size_t size)
{
char *cp = ptr;
while (size--)
@ -174,7 +174,7 @@ link_blk (struct hdr *hdr)
}
}
static void
freehook (__ptr_t ptr, const __ptr_t caller)
freehook (void *ptr, const void *caller)
{
if (pedantic)
mcheck_check_all ();
@ -197,8 +197,8 @@ freehook (__ptr_t ptr, const __ptr_t caller)
__free_hook = freehook;
}
static __ptr_t
mallochook (size_t size, const __ptr_t caller)
static void *
mallochook (size_t size, const void *caller)
{
struct hdr *hdr;
@ -226,13 +226,13 @@ mallochook (size_t size, const __ptr_t caller)
hdr->block = hdr;
hdr->magic2 = (uintptr_t) hdr ^ MAGICWORD;
((char *) &hdr[1])[size] = MAGICBYTE;
flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size);
return (__ptr_t) (hdr + 1);
flood ((void *) (hdr + 1), MALLOCFLOOD, size);
return (void *) (hdr + 1);
}
static __ptr_t
static void *
memalignhook (size_t alignment, size_t size,
const __ptr_t caller)
const void *caller)
{
struct hdr *hdr;
size_t slop;
@ -262,15 +262,15 @@ memalignhook (size_t alignment, size_t size,
hdr->size = size;
link_blk (hdr);
hdr->block = (__ptr_t) block;
hdr->block = (void *) block;
hdr->magic2 = (uintptr_t) block ^ MAGICWORD;
((char *) &hdr[1])[size] = MAGICBYTE;
flood ((__ptr_t) (hdr + 1), MALLOCFLOOD, size);
return (__ptr_t) (hdr + 1);
flood ((void *) (hdr + 1), MALLOCFLOOD, size);
return (void *) (hdr + 1);
}
static __ptr_t
reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
static void *
reallochook (void *ptr, size_t size, const void *caller)
{
if (size == 0)
{
@ -310,11 +310,11 @@ reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
__memalign_hook = old_memalign_hook;
__realloc_hook = old_realloc_hook;
if (old_realloc_hook != NULL)
hdr = (struct hdr *) (*old_realloc_hook)((__ptr_t) hdr,
hdr = (struct hdr *) (*old_realloc_hook)((void *) hdr,
sizeof (struct hdr) + size + 1,
caller);
else
hdr = (struct hdr *) realloc ((__ptr_t) hdr,
hdr = (struct hdr *) realloc ((void *) hdr,
sizeof (struct hdr) + size + 1);
__free_hook = freehook;
__malloc_hook = mallochook;
@ -330,7 +330,7 @@ reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
((char *) &hdr[1])[size] = MAGICBYTE;
if (size > osize)
flood ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize);
return (__ptr_t) (hdr + 1);
return (void *) (hdr + 1);
}
__attribute__ ((noreturn))
@ -410,7 +410,7 @@ mcheck_pedantic (void (*func) (enum mcheck_status))
}
enum mcheck_status
mprobe (__ptr_t ptr)
mprobe (void *ptr)
{
return mcheck_used ? checkhdr (((struct hdr *) ptr) - 1) : MCHECK_DISABLED;
}

View File

@ -50,15 +50,15 @@ static char *malloc_trace_buffer;
__libc_lock_define_initialized (static, lock);
/* Address to breakpoint on accesses to... */
__ptr_t mallwatch;
void *mallwatch;
/* Old hook values. */
static void (*tr_old_free_hook) (__ptr_t ptr, const __ptr_t);
static __ptr_t (*tr_old_malloc_hook) (size_t size, const __ptr_t);
static __ptr_t (*tr_old_realloc_hook) (__ptr_t ptr, size_t size,
const __ptr_t);
static __ptr_t (*tr_old_memalign_hook) (size_t __alignment, size_t __size,
const __ptr_t);
static void (*tr_old_free_hook) (void *ptr, const void *);
static void *(*tr_old_malloc_hook) (size_t size, const void *);
static void *(*tr_old_realloc_hook) (void *ptr, size_t size,
const void *);
static void *(*tr_old_memalign_hook) (size_t __alignment, size_t __size,
const void *);
/* This function is called when the block being alloc'd, realloc'd, or
freed has an address matching the variable "mallwatch". In a debugger,
@ -74,7 +74,7 @@ tr_break (void)
libc_hidden_def (tr_break)
static void internal_function
tr_where (const __ptr_t caller, Dl_info *info)
tr_where (const void *caller, Dl_info *info)
{
if (caller != NULL)
{
@ -87,12 +87,12 @@ tr_where (const __ptr_t caller, Dl_info *info)
buf = alloca (len + 6 + 2 * sizeof (void *));
buf[0] = '(';
__stpcpy (_fitoa (caller >= (const __ptr_t) info->dli_saddr
? caller - (const __ptr_t) info->dli_saddr
: (const __ptr_t) info->dli_saddr - caller,
__stpcpy (_fitoa (caller >= (const void *) info->dli_saddr
? caller - (const void *) info->dli_saddr
: (const void *) info->dli_saddr - caller,
__stpcpy (__mempcpy (buf + 1, info->dli_sname,
len),
caller >= (__ptr_t) info->dli_saddr
caller >= (void *) info->dli_saddr
? "+0x" : "-0x"),
16, 0),
")");
@ -108,7 +108,7 @@ tr_where (const __ptr_t caller, Dl_info *info)
}
static Dl_info *
lock_and_info (const __ptr_t caller, Dl_info *mem)
lock_and_info (const void *caller, Dl_info *mem)
{
if (caller == NULL)
return NULL;
@ -121,7 +121,7 @@ lock_and_info (const __ptr_t caller, Dl_info *mem)
}
static void
tr_freehook (__ptr_t ptr, const __ptr_t caller)
tr_freehook (void *ptr, const void *caller)
{
if (ptr == NULL)
return;
@ -146,19 +146,19 @@ tr_freehook (__ptr_t ptr, const __ptr_t caller)
__libc_lock_unlock (lock);
}
static __ptr_t
tr_mallochook (size_t size, const __ptr_t caller)
static void *
tr_mallochook (size_t size, const void *caller)
{
__ptr_t hdr;
void *hdr;
Dl_info mem;
Dl_info *info = lock_and_info (caller, &mem);
__malloc_hook = tr_old_malloc_hook;
if (tr_old_malloc_hook != NULL)
hdr = (__ptr_t) (*tr_old_malloc_hook)(size, caller);
hdr = (void *) (*tr_old_malloc_hook)(size, caller);
else
hdr = (__ptr_t) malloc (size);
hdr = (void *) malloc (size);
__malloc_hook = tr_mallochook;
tr_where (caller, info);
@ -173,10 +173,10 @@ tr_mallochook (size_t size, const __ptr_t caller)
return hdr;
}
static __ptr_t
tr_reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
static void *
tr_reallochook (void *ptr, size_t size, const void *caller)
{
__ptr_t hdr;
void *hdr;
if (ptr == mallwatch)
tr_break ();
@ -188,9 +188,9 @@ tr_reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
__malloc_hook = tr_old_malloc_hook;
__realloc_hook = tr_old_realloc_hook;
if (tr_old_realloc_hook != NULL)
hdr = (__ptr_t) (*tr_old_realloc_hook)(ptr, size, caller);
hdr = (void *) (*tr_old_realloc_hook)(ptr, size, caller);
else
hdr = (__ptr_t) realloc (ptr, size);
hdr = (void *) realloc (ptr, size);
__free_hook = tr_freehook;
__malloc_hook = tr_mallochook;
__realloc_hook = tr_reallochook;
@ -221,10 +221,10 @@ tr_reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
return hdr;
}
static __ptr_t
tr_memalignhook (size_t alignment, size_t size, const __ptr_t caller)
static void *
tr_memalignhook (size_t alignment, size_t size, const void *caller)
{
__ptr_t hdr;
void *hdr;
Dl_info mem;
Dl_info *info = lock_and_info (caller, &mem);
@ -232,9 +232,9 @@ tr_memalignhook (size_t alignment, size_t size, const __ptr_t caller)
__memalign_hook = tr_old_memalign_hook;
__malloc_hook = tr_old_malloc_hook;
if (tr_old_memalign_hook != NULL)
hdr = (__ptr_t) (*tr_old_memalign_hook)(alignment, size, caller);
hdr = (void *) (*tr_old_memalign_hook)(alignment, size, caller);
else
hdr = (__ptr_t) memalign (alignment, size);
hdr = (void *) memalign (alignment, size);
__memalign_hook = tr_memalignhook;
__malloc_hook = tr_mallochook;

View File

@ -24,7 +24,7 @@
#define __need___va_list
#include <stdarg.h>
#ifndef __GNUC_VA_LIST
# define __gnuc_va_list __ptr_t
# define __gnuc_va_list void *
#endif
__BEGIN_DECLS

View File

@ -28,8 +28,8 @@
for errors (in which case `errno' is set). A successful `mmap' call
deallocates any previous mapping for the affected region. */
__ptr_t
__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
void *
__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
__set_errno (ENOSYS);
return MAP_FAILED;

View File

@ -28,8 +28,8 @@
for errors (in which case `errno' is set). A successful `mmap' call
deallocates any previous mapping for the affected region. */
__ptr_t
__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
void *
__mmap64 (void *addr, size_t len, int prot, int flags, int fd,
__off64_t offset)
{
off_t small_offset = (off_t) offset;

View File

@ -24,7 +24,7 @@
(and sets errno). */
int
__mprotect (__ptr_t addr, size_t len, int prot)
__mprotect (void *addr, size_t len, int prot)
{
__set_errno (ENOSYS);
return -1;

View File

@ -24,7 +24,7 @@
unpredictable before this is done. */
int
msync (__ptr_t addr, size_t len, int flags)
msync (void *addr, size_t len, int flags)
{
__set_errno (ENOSYS);
return -1;

View File

@ -23,7 +23,7 @@
bytes. Returns 0 if successful, -1 for errors (and sets errno). */
int
__munmap (__ptr_t addr, size_t len)
__munmap (void *addr, size_t len)
{
__set_errno (ENOSYS);
return -1;

View File

@ -23,7 +23,7 @@
for the region starting at ADDR and extending LEN bytes. */
int
posix_madvise (__ptr_t addr, size_t len, int advice)
posix_madvise (void *addr, size_t len, int advice)
{
return ENOSYS;
}

View File

@ -20,7 +20,7 @@
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
ssize_t
__send (int fd, const __ptr_t buf, size_t n, int flags)
__send (int fd, const void *buf, size_t n, int flags)
{
__set_errno (ENOSYS);
return -1;

View File

@ -21,7 +21,7 @@
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
ssize_t
__sendto (int fd, const __ptr_t buf, size_t n, int flags,
__sendto (int fd, const void *buf, size_t n, int flags,
__CONST_SOCKADDR_ARG addr, socklen_t addr_len)
{
__set_errno (ENOSYS);

View File

@ -22,7 +22,7 @@
to *OPTVAL (which is OPTLEN bytes long).
Returns 0 on success, -1 for errors. */
int
__setsockopt (int fd, int level, int optname, const __ptr_t optval,
__setsockopt (int fd, int level, int optname, const void *optval,
socklen_t optlen)
{
__set_errno (ENOSYS);

View File

@ -20,9 +20,6 @@
# include "config.h"
#endif
#undef __ptr_t
#define __ptr_t void *
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#endif
@ -301,7 +298,7 @@ memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len)
}
int
MEMCMP (const __ptr_t s1, const __ptr_t s2, size_t len)
MEMCMP (const void *s1, const void *s2, size_t len)
{
op_t a0;
op_t b0;

View File

@ -27,9 +27,6 @@
# include <config.h>
#endif
#undef __ptr_t
#define __ptr_t void *
#if defined _LIBC
# include <string.h>
# include <memcopy.h>
@ -55,13 +52,13 @@
#endif
/* Search no more than N bytes of S for C. */
__ptr_t
void *
#ifndef MEMRCHR
__memrchr
#else
MEMRCHR
#endif
(const __ptr_t s, int c_in, size_t n)
(const void *s, int c_in, size_t n)
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
@ -77,7 +74,7 @@ MEMRCHR
& (sizeof (longword) - 1)) != 0;
--n)
if (*--char_ptr == c)
return (__ptr_t) char_ptr;
return (void *) char_ptr;
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
@ -162,22 +159,22 @@ MEMRCHR
#if LONG_MAX > 2147483647
if (cp[7] == c)
return (__ptr_t) &cp[7];
return (void *) &cp[7];
if (cp[6] == c)
return (__ptr_t) &cp[6];
return (void *) &cp[6];
if (cp[5] == c)
return (__ptr_t) &cp[5];
return (void *) &cp[5];
if (cp[4] == c)
return (__ptr_t) &cp[4];
return (void *) &cp[4];
#endif
if (cp[3] == c)
return (__ptr_t) &cp[3];
return (void *) &cp[3];
if (cp[2] == c)
return (__ptr_t) &cp[2];
return (void *) &cp[2];
if (cp[1] == c)
return (__ptr_t) &cp[1];
return (void *) &cp[1];
if (cp[0] == c)
return (__ptr_t) cp;
return (void *) cp;
}
n -= sizeof (longword);
@ -188,7 +185,7 @@ MEMRCHR
while (n-- > 0)
{
if (*--char_ptr == c)
return (__ptr_t) char_ptr;
return (void *) char_ptr;
}
return 0;

View File

@ -453,8 +453,8 @@ __libc_lseek64 (int fd, off64_t offset, int whence)
return offset;
}
__ptr_t weak_function
__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
void *weak_function
__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
error_t err;
vm_prot_t vmprot;
@ -512,7 +512,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
if (err)
return __hurd_fail (err), MAP_FAILED;
return (__ptr_t) mapaddr;
return (void *) mapaddr;
}
int weak_function

View File

@ -26,12 +26,12 @@
is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
set in FLAGS, the mapping will be at ADDR exactly (which must be
page-aligned); otherwise the system chooses a convenient nearby address.
The return value is the actual mapping address chosen or (__ptr_t) -1
The return value is the actual mapping address chosen or (void *) -1
for errors (in which case `errno' is set). A successful `mmap' call
deallocates any previous mapping for the affected region. */
__ptr_t
__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
void *
__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
error_t err;
vm_prot_t vmprot;
@ -42,7 +42,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
/* ADDR and OFFSET must be page-aligned. */
if ((mapaddr & (__vm_page_size - 1)) || (offset & (__vm_page_size - 1)))
return (__ptr_t) (long int) __hurd_fail (EINVAL);
return (void *) (long int) __hurd_fail (EINVAL);
if ((flags & (MAP_TYPE|MAP_INHERIT)) == MAP_ANON
&& prot == (PROT_READ|PROT_WRITE)) /* cf VM_PROT_DEFAULT */
@ -64,7 +64,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
err = __vm_allocate (__mach_task_self (), &mapaddr, len, 1);
}
return err ? (__ptr_t) (long int) __hurd_fail (err) : (__ptr_t) mapaddr;
return err ? (void *) (long int) __hurd_fail (err) : (void *) mapaddr;
}
vmprot = VM_PROT_NONE;
@ -78,7 +78,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
switch (flags & MAP_TYPE)
{
default:
return (__ptr_t) (long int) __hurd_fail (EINVAL);
return (void *) (long int) __hurd_fail (EINVAL);
case MAP_ANON:
memobj = MACH_PORT_NULL;
@ -92,7 +92,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
{
if (err == MIG_BAD_ID || err == EOPNOTSUPP || err == ENOSYS)
err = ENODEV; /* File descriptor doesn't support mmap. */
return (__ptr_t) (long int) __hurd_dfail (fd, err);
return (void *) (long int) __hurd_dfail (fd, err);
}
switch (prot & (PROT_READ|PROT_WRITE))
{
@ -129,7 +129,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
else
{
__mach_port_deallocate (__mach_task_self (), wobj);
return (__ptr_t) (long int) __hurd_fail (EACCES);
return (void *) (long int) __hurd_fail (EACCES);
}
break;
default:
@ -180,9 +180,9 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
__mach_port_deallocate (__mach_task_self (), memobj);
if (err)
return (__ptr_t) (long int) __hurd_fail (err);
return (void *) (long int) __hurd_fail (err);
return (__ptr_t) mapaddr;
return (void *) mapaddr;
}
weak_alias (__mmap, mmap)

View File

@ -28,8 +28,8 @@
for errors (in which case `errno' is set). A successful `mmap' call
deallocates any previous mapping for the affected region. */
__ptr_t
__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
void *
__mmap64 (void *addr, size_t len, int prot, int flags, int fd,
__off64_t offset)
{
vm_offset_t small_offset = (vm_offset_t) offset;

View File

@ -25,7 +25,7 @@
(and sets errno). */
int
__mprotect (__ptr_t addr, size_t len, int prot)
__mprotect (void *addr, size_t len, int prot)
{
kern_return_t err;
vm_prot_t vmprot;

View File

@ -33,7 +33,7 @@
unpredictable before this is done. */
int
msync (__ptr_t addr, size_t len, int flags)
msync (void *addr, size_t len, int flags)
{
vm_sync_t sync_flags = 0;
kern_return_t err;

View File

@ -24,7 +24,7 @@
bytes. Returns 0 if successful, -1 for errors (and sets errno). */
int
__munmap (__ptr_t addr, size_t len)
__munmap (void *addr, size_t len)
{
kern_return_t err;

View File

@ -29,19 +29,19 @@ typedef struct __jmp_buf_internal_tag
{
#if _MIPS_SIM == _ABIO32
/* Program counter. */
__ptr_t __pc;
void *__pc;
/* Stack pointer. */
__ptr_t __sp;
void *__sp;
/* Callee-saved registers s0 through s7. */
int __regs[8];
/* The frame pointer. */
__ptr_t __fp;
void *__fp;
/* The global pointer. */
__ptr_t __gp;
void *__gp;
#else
/* Program counter. */
__extension__ long long __pc;

View File

@ -318,7 +318,7 @@ __getcwd (char *buf, size_t size)
}
else
{
new = realloc ((__ptr_t) dotlist, dotsize * 2 + 1);
new = realloc ((void *) dotlist, dotsize * 2 + 1);
if (new == NULL)
goto lose;
dotp = &new[dotsize];
@ -492,7 +492,7 @@ __getcwd (char *buf, size_t size)
#ifndef __ASSUME_ATFCTS
if (dotlist != dots)
free ((__ptr_t) dotlist);
free ((void *) dotlist);
#endif
size_t used = path + allocated - pathp;
@ -516,7 +516,7 @@ __getcwd (char *buf, size_t size)
int save_errno = errno;
#ifndef __ASSUME_ATFCTS
if (dotlist != dots)
free ((__ptr_t) dotlist);
free ((void *) dotlist);
#endif
if (dirstream != NULL)
__closedir (dirstream);

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'.
The memset is done in four sizes: byte (8 bits), word (32 bits),

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'.
Memcpy handles short copies (< 32-bytes) using a binary move blocks

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'.
The memset is done in three sizes: byte (8 bits), word (32 bits),

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'.
Memcpy handles short copies (< 32-bytes) using a binary move blocks

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'.
The memset is done in three sizes: byte (8 bits), word (32 bits),

View File

@ -19,7 +19,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'. */
.machine power7

View File

@ -19,7 +19,7 @@
#include <sysdep.h>
/* __ptr_t [r3] __mempcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] __mempcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst' + 'len'. */
.machine power7

View File

@ -19,7 +19,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'. */
.machine power7

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'.
Memcpy handles short copies (< 32-bytes) using a binary move blocks

View File

@ -24,7 +24,7 @@
.section ".text"
.align 2
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'.
The memset is done in three sizes: byte (8 bits), word (32 bits),

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'.
Memcpy handles short copies (< 32-bytes) using a binary move blocks

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'.
The memset is done in three sizes: byte (8 bits), word (32 bits),

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'.
Memcpy handles short copies (< 32-bytes) using a binary move blocks

View File

@ -18,7 +18,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'.
The memset is done in three sizes: byte (8 bits), word (32 bits),

View File

@ -20,7 +20,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] memcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst'. */
#ifndef MEMCPY

View File

@ -20,7 +20,7 @@
#include <sysdep.h>
/* __ptr_t [r3] __mempcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
/* void * [r3] __mempcpy (void *dst [r3], void *src [r4], size_t len [r5]);
Returns 'dst' + 'len'. */
#ifndef MEMPCPY

View File

@ -19,7 +19,7 @@
#include <sysdep.h>
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'. */
#ifndef MEMSET

View File

@ -20,7 +20,7 @@
#define MTVSRD_V1_R4 .long 0x7c240166 /* mtvsrd v1,r4 */
/* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
/* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5]));
Returns 's'. */
#ifndef MEMSET

View File

@ -19,9 +19,6 @@
# include "config.h"
#endif
#undef __ptr_t
#define __ptr_t void *
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#endif
@ -294,7 +291,7 @@ memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len)
}
int
MEMCMP (const __ptr_t s1, const __ptr_t s2, size_t len)
MEMCMP (const void *s1, const void *s2, size_t len)
{
op_t a0;
op_t b0;

View File

@ -36,7 +36,7 @@ typedef struct
are used instead of the normal file access functions. */
void (*gl_closedir) (void *);
struct dirent *(*gl_readdir) (void *);
__ptr_t (*gl_opendir) (const char *);
void *(*gl_opendir) (const char *);
int (*gl_lstat) (const char *, struct stat *);
int (*gl_stat) (const char *, struct stat *);
} old_glob_t;

View File

@ -36,7 +36,7 @@ __mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
MMAP_CHECK_PAGE_UNIT ();
if (offset & MMAP_OFF_LOW_MASK)
return (__ptr_t) INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
#ifdef __NR_mmap2
return (void *) MMAP_CALL (mmap2, addr, len, prot, flags, fd,