about summary refs log tree commit diff
path: root/wcsmbs/wchar.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /wcsmbs/wchar.h
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'wcsmbs/wchar.h')
-rw-r--r--wcsmbs/wchar.h52
1 files changed, 45 insertions, 7 deletions
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 1fe7e94d92..f54abfaa96 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2004,2005,2006 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
@@ -320,6 +320,24 @@ __END_NAMESPACE_C99
 
 #ifdef __USE_EXTERN_INLINES
 /* Define inline function as optimization.  */
+
+# ifndef __cplusplus
+/* We can use the BTOWC and WCTOB optimizations since we know that all
+   locales must use ASCII encoding for the values in the ASCII range
+   and because the wchar_t encoding is always ISO 10646.  */
+extern wint_t __btowc_alias (int __c) __asm ("btowc");
+extern __inline wint_t
+__NTH (btowc (int __c))
+{ return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f'
+	  ? (wint_t) __c : __btowc_alias (__c)); }
+
+extern int __wctob_alias (wint_t __c) __asm ("wctob");
+extern __inline int
+__NTH (wctob (wint_t __wc))
+{ return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f'
+	  ? (int) __wc : __wctob_alias (__wc)); }
+# endif
+
 extern __inline size_t
 __NTH (mbrlen (__const char *__restrict __s, size_t __n,
 	       mbstate_t *__restrict __ps))
@@ -491,26 +509,30 @@ extern long double __wcstold_internal (__const wchar_t *__restrict __nptr,
 				       wchar_t **__restrict __endptr,
 				       int __group) __THROW;
 
-#ifndef __wcstol_internal_defined
+#if !defined __wcstol_internal_defined \
+    && defined __OPTIMIZE__ && __GNUC__ >= 2
 extern long int __wcstol_internal (__const wchar_t *__restrict __nptr,
 				   wchar_t **__restrict __endptr,
 				   int __base, int __group) __THROW;
 # define __wcstol_internal_defined	1
 #endif
-#ifndef __wcstoul_internal_defined
+#if !defined __wcstoul_internal_defined \
+    && defined __OPTIMIZE__ && __GNUC__ >= 2
 extern unsigned long int __wcstoul_internal (__const wchar_t *__restrict __npt,
 					     wchar_t **__restrict __endptr,
 					     int __base, int __group) __THROW;
 # define __wcstoul_internal_defined	1
 #endif
-#ifndef __wcstoll_internal_defined
+#if !defined __wcstoll_internal_defined \
+    && defined __OPTIMIZE__ && __GNUC__ >= 2
 __extension__
 extern long long int __wcstoll_internal (__const wchar_t *__restrict __nptr,
 					 wchar_t **__restrict __endptr,
 					 int __base, int __group) __THROW;
 # define __wcstoll_internal_defined	1
 #endif
-#ifndef __wcstoull_internal_defined
+#if !defined __wcstoull_internal_defined \
+    && defined __OPTIMIZE__ && __GNUC__ >= 2
 __extension__
 extern unsigned long long int __wcstoull_internal (__const wchar_t *
 						   __restrict __nptr,
@@ -545,12 +567,12 @@ extern __inline float
 __NTH (wcstof (__const wchar_t *__restrict __nptr,
 	       wchar_t **__restrict __endptr))
 { return __wcstof_internal (__nptr, __endptr, 0); }
+#  ifndef __LDBL_COMPAT
 extern __inline long double
 __NTH (wcstold (__const wchar_t *__restrict __nptr,
 		wchar_t **__restrict __endptr))
 { return __wcstold_internal (__nptr, __endptr, 0); }
-
-
+#  endif
 __extension__
 extern __inline long long int
 __NTH (wcstoq (__const wchar_t *__restrict __nptr,
@@ -578,6 +600,13 @@ extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
 
 
 /* Wide character I/O functions.  */
+
+#ifdef	__USE_GNU
+/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces
+   a wide character string.  */
+extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
+#endif
+
 #if defined __USE_ISOC99 || defined __USE_UNIX98
 __BEGIN_NAMESPACE_C99
 
@@ -817,6 +846,15 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
 # include <wctype.h>
 #endif
 
+/* Define some macros helping to catch buffer overflows.  */
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+# include <bits/wchar2.h>
+#endif
+
+#ifdef __LDBL_COMPAT
+# include <bits/wchar-ldbl.h>
+#endif
+
 __END_DECLS
 
 #endif	/* _WCHAR_H defined */