aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-07-25 21:41:45 +0000
committerUlrich Drepper <drepper@redhat.com>2005-07-25 21:41:45 +0000
commit02ca3541ce1b81a6778ca811cc251a30280d0120 (patch)
tree579e15f10e08b0f7bf7f154f98dfd524a7430aa5 /stdlib
parent09987e425cce292a7202de18a9ef1bb62529a77f (diff)
downloadglibc-02ca3541ce1b81a6778ca811cc251a30280d0120.zip
glibc-02ca3541ce1b81a6778ca811cc251a30280d0120.tar.gz
glibc-02ca3541ce1b81a6778ca811cc251a30280d0120.tar.bz2
* debug/mbstowcs_chk.c: New file.
* debug/wcstombs_chk.c: New file. * debug/Makefile (routines): Add mbstowcs_chk and wcstombs_chk. * debug/Versions: Add __mbstowcs_chk and __wcstombs_chk. * stdlib/bits/stdlib.h: Add definitions for mbstowcs and wcstombs. * wcsmbs/bits/wchar2.h (mbsrtowcs): Pretty printing. * string/test-memset.c (test_main): Use negative byte value in
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/bits/stdlib.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h
index 7ca6c86..9ff8f62 100644
--- a/stdlib/bits/stdlib.h
+++ b/stdlib/bits/stdlib.h
@@ -73,3 +73,42 @@ wctomb (char *__s, wchar_t __wchar)
return __wctomb_chk (__s, __wchar, __bos (__s));
return __wctomb_alias (__s, __wchar);
}
+
+
+extern size_t __mbstowcs_chk (wchar_t *__restrict __dst,
+ __const char *__restrict __src,
+ size_t __len, size_t __dstlen) __THROW;
+extern size_t __REDIRECT_NTH (__mbstowcs_alias,
+ (wchar_t *__restrict __dst,
+ __const char *__restrict __src,
+ size_t __len), mbstowcs);
+
+extern __always_inline size_t
+mbstowcs (wchar_t *__restrict __dst, __const char *__restrict __src,
+ size_t __len)
+{
+ if (__bos (__dst) != (size_t) -1
+ && (!__builtin_constant_p (__len)
+ || __len * sizeof (wchar_t) > __bos (__dst)))
+ return __mbstowcs_chk (__dst, __src, __len, __bos (__dst));
+ return __mbstowcs_alias (__dst, __src, __len);
+}
+
+
+extern size_t __wcstombs_chk (char *__restrict __dst,
+ __const wchar_t *__restrict __src,
+ size_t __len, size_t __dstlen) __THROW;
+extern size_t __REDIRECT_NTH (__wcstombs_alias,
+ (char *__restrict __dst,
+ __const wchar_t *__restrict __src,
+ size_t __len), wcstombs);
+
+extern __always_inline size_t
+wcstombs (char *__restrict __dst, __const wchar_t *__restrict __src,
+ size_t __len)
+{
+ if (__bos (__dst) != (size_t) -1
+ && (!__builtin_constant_p (__len) || __len > __bos (__dst)))
+ return __wcstombs_chk (__dst, __src, __len, __bos (__dst));
+ return __wcstombs_alias (__dst, __src, __len);
+}