diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-08-21 17:12:43 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-08-21 17:12:43 +0000 |
commit | 6c6bb0558c6adebd450cc7037305f89e746597b5 (patch) | |
tree | 062811cf59fbbb94bab8d7cc02894772cbe2d412 | |
parent | 425966d0707380015fcbcbc9b206500761ab8505 (diff) | |
download | glibc-6c6bb0558c6adebd450cc7037305f89e746597b5.tar.gz glibc-6c6bb0558c6adebd450cc7037305f89e746597b5.tar.xz glibc-6c6bb0558c6adebd450cc7037305f89e746597b5.zip |
Update.
* string/bits/string2.h: Remove strnlen optimization here. * sysdeps/i386/i486/bits/string.h: Add it here. 2001-08-21 Wolfram Gloger <wg@malloc.de> * malloc/malloc.c: Make access to ..._hook pointers thread-safe. 2001-08-21 Ulrich Drepper <drepper@redhat.com>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | malloc/malloc.c | 43 | ||||
-rw-r--r-- | string/bits/string2.h | 12 | ||||
-rw-r--r-- | sysdeps/i386/i486/bits/string.h | 14 |
4 files changed, 50 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog index 1006a07534..9b5bc4288b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2001-08-21 Ulrich Drepper <drepper@redhat.com> + * string/bits/string2.h: Remove strnlen optimization here. + * sysdeps/i386/i486/bits/string.h: Add it here. + +2001-08-21 Wolfram Gloger <wg@malloc.de> + + * malloc/malloc.c: Make access to ..._hook pointers thread-safe. + +2001-08-21 Ulrich Drepper <drepper@redhat.com> + * po/gl.po: Update from translation team. 2001-08-20 Ulrich Drepper <drepper@redhat.com> diff --git a/malloc/malloc.c b/malloc/malloc.c index 92de6e44e9..6722ac41c0 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -2788,13 +2788,15 @@ Void_t* mALLOc(bytes) size_t bytes; mchunkptr victim; #if defined _LIBC || defined MALLOC_HOOKS - if (__malloc_hook != NULL) { + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) = + __malloc_hook; + if (hook != NULL) { Void_t* result; #if defined __GNUC__ && __GNUC__ >= 2 - result = (*__malloc_hook)(bytes, RETURN_ADDRESS (0)); + result = (*hook)(bytes, RETURN_ADDRESS (0)); #else - result = (*__malloc_hook)(bytes, NULL); + result = (*hook)(bytes, NULL); #endif return result; } @@ -3111,11 +3113,14 @@ void fREe(mem) Void_t* mem; mchunkptr p; /* chunk corresponding to mem */ #if defined _LIBC || defined MALLOC_HOOKS - if (__free_hook != NULL) { + void (*hook) __MALLOC_PMT ((__malloc_ptr_t, __const __malloc_ptr_t)) = + __free_hook; + + if (hook != NULL) { #if defined __GNUC__ && __GNUC__ >= 2 - (*__free_hook)(mem, RETURN_ADDRESS (0)); + (*hook)(mem, RETURN_ADDRESS (0)); #else - (*__free_hook)(mem, NULL); + (*hook)(mem, NULL); #endif return; } @@ -3314,13 +3319,16 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; mchunkptr newp; /* chunk to return */ #if defined _LIBC || defined MALLOC_HOOKS - if (__realloc_hook != NULL) { + __malloc_ptr_t (*hook) __MALLOC_PMT ((__malloc_ptr_t, size_t, + __const __malloc_ptr_t)) = + __realloc_hook; + if (hook != NULL) { Void_t* result; #if defined __GNUC__ && __GNUC__ >= 2 - result = (*__realloc_hook)(oldmem, bytes, RETURN_ADDRESS (0)); + result = (*hook)(oldmem, bytes, RETURN_ADDRESS (0)); #else - result = (*__realloc_hook)(oldmem, bytes, NULL); + result = (*hook)(oldmem, bytes, NULL); #endif return result; } @@ -3596,13 +3604,16 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; mchunkptr p; #if defined _LIBC || defined MALLOC_HOOKS - if (__memalign_hook != NULL) { + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t, + __const __malloc_ptr_t)) = + __memalign_hook; + if (hook != NULL) { Void_t* result; #if defined __GNUC__ && __GNUC__ >= 2 - result = (*__memalign_hook)(alignment, bytes, RETURN_ADDRESS (0)); + result = (*hook)(alignment, bytes, RETURN_ADDRESS (0)); #else - result = (*__memalign_hook)(alignment, bytes, NULL); + result = (*hook)(alignment, bytes, NULL); #endif return result; } @@ -3788,12 +3799,14 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size; Void_t* mem; #if defined _LIBC || defined MALLOC_HOOKS - if (__malloc_hook != NULL) { + __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) = + __malloc_hook; + if (hook != NULL) { sz = n * elem_size; #if defined __GNUC__ && __GNUC__ >= 2 - mem = (*__malloc_hook)(sz, RETURN_ADDRESS (0)); + mem = (*hook)(sz, RETURN_ADDRESS (0)); #else - mem = (*__malloc_hook)(sz, NULL); + mem = (*hook)(sz, NULL); #endif if(mem == 0) return 0; diff --git a/string/bits/string2.h b/string/bits/string2.h index 213ab2e516..1caa81b403 100644 --- a/string/bits/string2.h +++ b/string/bits/string2.h @@ -1021,18 +1021,6 @@ __strpbrk_c3 (__const char *__s, int __accept1, int __accept2, #endif -#if defined __USE_GNU && !defined _FORCE_INLINES -# ifndef _HAVE_STRING_ARCH_strnlen -__STRING_INLINE size_t -strnlen (__const char *__string, size_t __maxlen) -{ - __const char *__end = (__const char *) memchr (__string, '\0', __maxlen); - return __end ? (size_t) (__end - __string) : __maxlen; -} -# endif -#endif - - #ifndef _HAVE_STRING_ARCH_strtok_r # define __strtok_r(s, sep, nextp) \ (__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep) \ diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index a21fc8b830..bbe39adab7 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -1,5 +1,5 @@ /* Optimized, inlined string functions. i486 version. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001 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 @@ -540,6 +540,18 @@ __strlen_g (__const char *__str) } + +#if defined __USE_GNU +#define _HAVE_STRING_ARCH_strnlen 1 +__STRING_INLINE size_t +strnlen (__const char *__string, size_t __maxlen) +{ + __const char *__end = (__const char *) memchr (__string, '\0', __maxlen); + return __end ? (size_t) (__end - __string) : __maxlen; +} +#endif + + /* Copy SRC to DEST. */ #define _HAVE_STRING_ARCH_strcpy 1 #define strcpy(dest, src) \ |