diff options
| author | Peter S. Mazinger <ps.m@gmx.net> | 2005-11-27 00:24:52 +0000 | 
|---|---|---|
| committer | Peter S. Mazinger <ps.m@gmx.net> | 2005-11-27 00:24:52 +0000 | 
| commit | de77369cf4e80cb3c5ec250a25d2237df4abba11 (patch) | |
| tree | 2b009a3af825a43ef30bae8ac512b9b9686c3ad8 /libc | |
| parent | 43cfeab2dcf300fbe024aa341d146179b4cdc75a (diff) | |
Hide some of mem* and str*
Diffstat (limited to 'libc')
35 files changed, 114 insertions, 17 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c index 5c4005a18..35b590073 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -16,6 +16,10 @@   * Changed to use _int10tostr.   */ +#define _uintmaxtostr __libc__uintmaxtostr +/* for some reason this does not work here */ +#define memmove __memmove +  #define _GNU_SOURCE  #define __FORCE_GLIBC  #include <features.h> diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index 553d5a944..228e04f97 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -44,6 +44,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  /* This software is Copyright 1996 by Craig Metz, All Rights Reserved.  */ +#define memcpy __memcpy +  #define _GNU_SOURCE  #define __FORCE_GLIBC  #include <features.h> diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index c9f35f149..85b9fc26f 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -51,6 +51,8 @@  ** SUCH DAMAGE.  */ +#define strpbrk __strpbrk +  #define __FORCE_GLIBC  #define _GNU_SOURCE  #include <features.h> diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index cbe5c503b..a8279e4db 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -51,6 +51,7 @@  ** SUCH DAMAGE.  */ +#define strpbrk __strpbrk  #define __FORCE_GLIBC  #define _GNU_SOURCE diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c index 35c302950..3a9f5f477 100644 --- a/libc/inet/ntop.c +++ b/libc/inet/ntop.c @@ -15,6 +15,8 @@   * SOFTWARE.   */ +#define memmove __memmove +  #define __FORCE_GLIBC  #include <features.h>  #include <sys/param.h> diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 9104c2456..01ccdb819 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -133,6 +133,11 @@   *   */ +#define memmove __memmove +#define strnlen __strnlen +#define strncat __strncat +#define strstr __strstr +  #define __FORCE_GLIBC  #include <features.h>  #include <string.h> diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c index eddf24587..576d11154 100644 --- a/libc/misc/error/error.c +++ b/libc/misc/error/error.c @@ -22,6 +22,8 @@  /* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */  /* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */ +#define strerror __strerror +  #include <stdio.h>  #include <stdarg.h>  #include <stdlib.h> diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index e58c3e6ca..cf410ba02 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -18,6 +18,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define mempcpy __libc_mempcpy +  #define _GNU_SOURCE  #include <features.h> diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c index 0d788df53..246402113 100644 --- a/libc/misc/glob/glob.c +++ b/libc/misc/glob/glob.c @@ -15,6 +15,9 @@ License along with this library; see the file COPYING.LIB.  If  not, write to the Free Software Foundation, Inc., 675 Mass Ave,  Cambridge, MA 02139, USA.  */ +#define strrchr __strrchr +#define strcoll __strcoll +  #include <features.h>  #include <stdlib.h>  #include <string.h> diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 6e5830733..da62b04ce 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -46,6 +46,8 @@   *    locale support had (8-bit codesets only).   */ +#define strtok_r __strtok_r +  #define _GNU_SOURCE  #define __CTYPE_HAS_8_BIT_LOCALES 1 diff --git a/libc/misc/mntent/mntent.c b/libc/misc/mntent/mntent.c index d98a6870f..1af5a6b67 100644 --- a/libc/misc/mntent/mntent.c +++ b/libc/misc/mntent/mntent.c @@ -1,3 +1,6 @@ +#define strtok_r __strtok_r +#define strstr __strstr +  #include <stdio.h>  #include <stdlib.h>  #include <string.h> diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c index 0e8a18f5d..5f2e90da3 100644 --- a/libc/misc/regex/regex.c +++ b/libc/misc/regex/regex.c @@ -20,6 +20,14 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define HAVE_MEMPCPY +#define __mempcpy __libc_mempcpy +#define memset __memset +#define memcmp __memcmp +#define strcmp __strcmp +#define strlen __strlen +/* for some reason this does not work */ +#define memcpy __memcpy  /* To exclude some unwanted junk.... */  #undef _LIBC @@ -30,6 +38,9 @@  #include <string.h>  #define STDC_HEADERS +extern void *__libc_mempcpy (void *__restrict __dest, +			__const void *__restrict __src, size_t __n) /*attribute_hidden*/; +  /* AIX requires this to be the first thing in the file. */  #if defined _AIX && !defined REGEX_MALLOC    #pragma alloca diff --git a/libc/misc/statfs/fstatvfs.c b/libc/misc/statfs/fstatvfs.c index 5e08f51ad..b79195e73 100644 --- a/libc/misc/statfs/fstatvfs.c +++ b/libc/misc/statfs/fstatvfs.c @@ -17,6 +17,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define strsep __strsep +  #include <features.h>  #define __USE_GNU diff --git a/libc/misc/statfs/fstatvfs64.c b/libc/misc/statfs/fstatvfs64.c index ed4b63234..0d7416df3 100644 --- a/libc/misc/statfs/fstatvfs64.c +++ b/libc/misc/statfs/fstatvfs64.c @@ -17,6 +17,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define strsep __strsep +  #include <features.h>  #ifdef __UCLIBC_HAS_LFS__ diff --git a/libc/misc/statfs/statvfs.c b/libc/misc/statfs/statvfs.c index 02a95fcde..0fe239573 100644 --- a/libc/misc/statfs/statvfs.c +++ b/libc/misc/statfs/statvfs.c @@ -17,6 +17,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define strsep __strsep +  #include <features.h>  #define __USE_GNU diff --git a/libc/misc/statfs/statvfs64.c b/libc/misc/statfs/statvfs64.c index 78d1a4c3f..8bacbba70 100644 --- a/libc/misc/statfs/statvfs64.c +++ b/libc/misc/statfs/statvfs64.c @@ -17,6 +17,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define strsep __strsep +  #include <features.h>  #ifdef __UCLIBC_HAS_LFS__ diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c index 704336006..dc30db913 100644 --- a/libc/misc/syslog/syslog.c +++ b/libc/misc/syslog/syslog.c @@ -31,6 +31,8 @@   * SUCH DAMAGE.   */ +#define memmove __memmove +  #define __FORCE_GLIBC  #define _GNU_SOURCE  #include <features.h> diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 0eda2a4d1..67add6845 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -129,6 +129,9 @@   *            differs (intentionally) from glibc's behavior.   */ +#define _uintmaxtostr __libc__uintmaxtostr +#define strnlen __strnlen +  #define _GNU_SOURCE  #include <stdio.h>  #include <stdlib.h> diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c index c9eb8df39..6778120b2 100644 --- a/libc/misc/wchar/wchar.c +++ b/libc/misc/wchar/wchar.c @@ -98,6 +98,8 @@   * Manuel   */ +#define memmove __memmove +  #define _GNU_SOURCE  #define _ISOC99_SOURCE  #include <errno.h> diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index 628b8f3fe..979723524 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -19,6 +19,10 @@     write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA.  */ +#define mempcpy __libc_mempcpy +#define strndup __strndup +#define strspn __strspn +  #define _GNU_SOURCE  #include <sys/cdefs.h>  #include <sys/types.h> diff --git a/libc/stdio/_fwrite.c b/libc/stdio/_fwrite.c index d9d0bc2a8..6657b0849 100644 --- a/libc/stdio/_fwrite.c +++ b/libc/stdio/_fwrite.c @@ -5,6 +5,9 @@   * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.   */ +#define memrchr __memrchr +#define memchr __memchr +  #include "_stdio.h"  #ifdef __STDIO_BUFFERS diff --git a/libc/stdio/_stdio.h b/libc/stdio/_stdio.h index acc6068c7..e5d3c0787 100644 --- a/libc/stdio/_stdio.h +++ b/libc/stdio/_stdio.h @@ -7,6 +7,7 @@  #define _GNU_SOURCE +#include <features.h>  #include <assert.h>  #include <errno.h>  #include <fcntl.h> @@ -17,7 +18,6 @@  #include <stdlib.h>  #include <string.h>  #include <unistd.h> -#include <features.h>  #ifdef __UCLIBC_HAS_WCHAR__  #include <wchar.h> diff --git a/libc/stdio/_wfwrite.c b/libc/stdio/_wfwrite.c index 0febbf45a..792cff604 100644 --- a/libc/stdio/_wfwrite.c +++ b/libc/stdio/_wfwrite.c @@ -5,6 +5,8 @@   * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.   */ +#define wmemcpy __wmemcpy +  #include "_stdio.h"  #include <wchar.h> diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c index 36e4d89b9..97049d379 100644 --- a/libc/stdio/old_vfprintf.c +++ b/libc/stdio/old_vfprintf.c @@ -128,6 +128,7 @@  /**************************************************************************/  #define _uintmaxtostr __libc__uintmaxtostr +#define strnlen __strnlen  #define _ISOC99_SOURCE			/* for ULLONG primarily... */  #define _GNU_SOURCE				/* for strnlen */ diff --git a/libc/stdio/vfprintf.c b/libc/stdio/vfprintf.c index 5f13a8eed..2adcefde5 100644 --- a/libc/stdio/vfprintf.c +++ b/libc/stdio/vfprintf.c @@ -89,6 +89,7 @@   */  #define _uintmaxtostr __libc__uintmaxtostr +#define strnlen __strnlen  #define _ISOC99_SOURCE			/* for ULLONG primarily... */  #define _GNU_SOURCE diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 677505953..4ed70427e 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -17,6 +17,8 @@     write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA.  */ +#define _uintmaxtostr __libc__uintmaxtostr +  #define _ISOC99_SOURCE  #include <stdio.h>  #include <errno.h> diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 2428ed92d..5545c6782 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -19,6 +19,8 @@     modified for uClibc by Erik Andersen <andersen@codepoet.org>     */ +#define strndup __strndup +  #define _GNU_SOURCE  #include <features.h>  #include <errno.h> diff --git a/libc/stdlib/unix_grantpt.c b/libc/stdlib/unix_grantpt.c index 4d1b56adf..d5e68b47e 100644 --- a/libc/stdlib/unix_grantpt.c +++ b/libc/stdlib/unix_grantpt.c @@ -17,6 +17,8 @@     write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,     Boston, MA 02111-1307, USA.  */ +#define memchr __memchr +  #include <assert.h>  #include <errno.h>  #include <grp.h> diff --git a/libc/string/generic/memmove.c b/libc/string/generic/memmove.c index ddf7c8aa4..a2c38a9b5 100644 --- a/libc/string/generic/memmove.c +++ b/libc/string/generic/memmove.c @@ -19,6 +19,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define memcpy __memcpy +  #include <string.h>  #include "memcopy.h" diff --git a/libc/string/generic/strsep.c b/libc/string/generic/strsep.c index 77670607b..b46610849 100644 --- a/libc/string/generic/strsep.c +++ b/libc/string/generic/strsep.c @@ -16,6 +16,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define strpbrk __strpbrk +  #include <string.h>  #undef strsep diff --git a/libc/string/generic/strtok_r.c b/libc/string/generic/strtok_r.c index 40d4e1a78..6daa68124 100644 --- a/libc/string/generic/strtok_r.c +++ b/libc/string/generic/strtok_r.c @@ -17,6 +17,10 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define rawmemchr __rawmemchr +#define strspn __strspn +#define strpbrk __strpbrk +  #define _GNU_SOURCE  #include <string.h> diff --git a/libc/string/strtok_r.c b/libc/string/strtok_r.c index ac86cb168..3f92c034d 100644 --- a/libc/string/strtok_r.c +++ b/libc/string/strtok_r.c @@ -8,9 +8,9 @@  #define Wstrtok_r __strtok_r  #undef Wstrspn -#define Wstrspn strspn +#define Wstrspn __strspn  #undef Wstrpbrk -#define Wstrpbrk strpbrk +#define Wstrpbrk __strpbrk  #include "wstring.c" diff --git a/libc/string/wstring.c b/libc/string/wstring.c index 797329a89..1223929ff 100644 --- a/libc/string/wstring.c +++ b/libc/string/wstring.c @@ -26,7 +26,10 @@   *  mapping of signal strings (alpha, mips, hppa, sparc).   */ +#define _uintmaxtostr __libc__uintmaxtostr +  #define _GNU_SOURCE +#include <features.h>  #include <string.h>  #include <strings.h>  #include <stdio.h> @@ -59,6 +62,17 @@ typedef unsigned char	__string_uchar_t;  #endif + +extern void *__memcpy (void *__restrict __dest, +		     __const void *__restrict __src, size_t __n) attribute_hidden; +extern void *__memmove (void *__dest, __const void *__src, size_t __n) attribute_hidden; +extern void *__memset (void *__s, int __c, size_t __n) attribute_hidden; +extern int __memcmp (__const void *__s1, __const void *__s2, size_t __n) attribute_hidden; +extern size_t __strnlen (__const char *__string, size_t __maxlen) attribute_hidden; +extern char *__strpbrk (__const char *__s, __const char *__accept) attribute_hidden; +extern size_t __strspn (__const char *__s, __const char *__accept) attribute_hidden; +extern char *__strsignal (int __sig) attribute_hidden; +  /**********************************************************************/  /* NOTE: If we ever do internationalized syserr messages, this will   * have to be changed! */ @@ -1649,7 +1663,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)  #endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */      s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown); -    memcpy(s, unknown, sizeof(unknown)); +    __memcpy(s, unknown, sizeof(unknown));   GOT_MESG:      if (!strerrbuf) {		/* SUSv3  */ @@ -1662,7 +1676,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)      }      if (i) { -		memcpy(strerrbuf, s, i); +		__memcpy(strerrbuf, s, i);  		strerrbuf[i-1] = 0;	/* In case buf was too small. */      } @@ -1685,7 +1699,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)      };      s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown); -    memcpy(s, unknown, sizeof(unknown)); +    __memcpy(s, unknown, sizeof(unknown));      if (!strerrbuf) {		/* SUSv3  */  		buflen = 0; @@ -1701,7 +1715,7 @@ int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)      }      if (i) { -		memcpy(strerrbuf, s, i); +		__memcpy(strerrbuf, s, i);  		strerrbuf[i-1] = 0;	/* In case buf was too small. */      } @@ -1914,7 +1928,7 @@ Wchar attribute_hidden *Wstpncpy(register Wchar * __restrict s1,  void attribute_hidden __bzero(void *s, size_t n)  {  #if 1 -	(void)memset(s, 0, n); +	(void)__memset(s, 0, n);  #else  	register unsigned char *p = s;  #ifdef __BCC__ @@ -1945,7 +1959,7 @@ strong_alias(__bzero, bzero)  void attribute_hidden __bcopy(const void *s2, void *s1, size_t n)  {  #if 1 -	memmove(s1, s2, n); +	__memmove(s1, s2, n);  #else  #ifdef __BCC__  	register char *s; @@ -2043,10 +2057,10 @@ char attribute_hidden *__strndup(register const char *s1, size_t n)  {  	register char *s; -	n = strnlen(s1,n);			/* Avoid problems if s1 not nul-terminated. */ +	n = __strnlen(s1,n);			/* Avoid problems if s1 not nul-terminated. */      if ((s = malloc(n + 1)) != NULL) { -		memcpy(s, s1, n); +		__memcpy(s, s1, n);  		s[n] = 0;  	} @@ -2067,7 +2081,7 @@ char attribute_hidden *__strsep(char ** __restrict s1, const char * __restrict s  #if 1  	p = NULL; -	if (s && *s && (p = strpbrk(s, s2))) { +	if (s && *s && (p = __strpbrk(s, s2))) {  		*p++ = 0;  	}  #else @@ -2504,7 +2518,7 @@ char attribute_hidden *__strsignal(int signum)      }      s = _int10tostr(buf+sizeof(buf)-1, signum) - sizeof(unknown); -    memcpy(s, unknown, sizeof(unknown)); +    __memcpy(s, unknown, sizeof(unknown));   DONE:  	return s; @@ -2519,7 +2533,7 @@ char attribute_hidden *__strsignal(int signum)  		'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 's', 'i', 'g', 'n', 'a', 'l', ' '      }; -    return (char *) memcpy(_int10tostr(buf+sizeof(buf)-1, signum) +    return (char *) __memcpy(_int10tostr(buf+sizeof(buf)-1, signum)  						   - sizeof(unknown),  						   unknown, sizeof(unknown));  } @@ -2547,7 +2561,7 @@ void psignal(int signum, register const char *message)  		message = (sep += 2);	/* or passed an empty string. */  	} -	fprintf(stderr, "%s%s%s\n", message, sep, strsignal(signum)); +	fprintf(stderr, "%s%s%s\n", message, sep, __strsignal(signum));  }  #endif @@ -2674,7 +2688,7 @@ static int lookup(wchar_t wc   __LOCALE_PARAM )  static void init_col_state(col_state_t *cs, const Wchar *wcs)  { -	memset(cs, 0, sizeof(col_state_t)); +	__memset(cs, 0, sizeof(col_state_t));  	cs->s = wcs;  	cs->bp = cs->back_buf = cs->ibb;  	cs->bb_size = 128; @@ -2906,7 +2920,7 @@ static void next_weight(col_state_t *cs, int pass   __LOCALE_PARAM )  								cs->weight = 0;  								return;  							} -							memcpy(cs->bp, cs->back_buf, cs->bb_size); +							__memcpy(cs->bp, cs->back_buf, cs->bb_size);  						} else {  							cs->bp = realloc(cs->back_buf, cs->bb_size + 128); diff --git a/libc/termios/tcgetattr.c b/libc/termios/tcgetattr.c index 8e011b95e..e671309b6 100644 --- a/libc/termios/tcgetattr.c +++ b/libc/termios/tcgetattr.c @@ -16,6 +16,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define mempcpy __libc_mempcpy +  #include <features.h>  #define __USE_GNU  #include <string.h> diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c index 682eb4bc4..2759a6d25 100644 --- a/libc/unistd/getsubopt.c +++ b/libc/unistd/getsubopt.c @@ -18,6 +18,8 @@     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA     02111-1307 USA.  */ +#define memchr __memchr +  #include <stdlib.h>  #include <string.h>  | 
