summaryrefslogtreecommitdiff
path: root/libc/string/wstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/string/wstring.c')
-rw-r--r--libc/string/wstring.c42
1 files changed, 28 insertions, 14 deletions
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);