about summary refs log tree commit diff
path: root/wctype/wctype.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-01-11 20:13:43 +0000
committerUlrich Drepper <drepper@redhat.com>1999-01-11 20:13:43 +0000
commit390955cbdeb674bead490fc3f74a8a0893ea83cf (patch)
tree2900fdc697f52133f633c09edbbe712882736bf0 /wctype/wctype.h
parent68ef28edc2f1bafa417da1ac8d35a3bf2a1b565b (diff)
downloadglibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.tar.gz
glibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.tar.xz
glibc-390955cbdeb674bead490fc3f74a8a0893ea83cf.zip
Update.
1999-01-11  Ulrich Drepper  <drepper@cygnus.com>

	* ctype/Versions [GLIBC_2.0]: Export __ctype32_b.
	* include/wctype.h: Declare __iswctype.
	* stdio-common/vfscanf.c (__vfscanf): Use __iswspace instead of
	iswspace.
	* wctype/Makefile (routines): Add wcextra_l.
	* wctype/wcextra.c (iswblank): Implement function here and don't use
	__iswctype.
	(__iswblank_l):  Move definition to...
	* wctype/wcextra_l.c: ...here.  New file.
	* wctype/wcfuncs.c: Really implement functions and don't call
	__iswctype or __towctrans.
	* wctype/wctype.h: Change isw* and tow* macros.  Don't call
	__iswctype or __towctrans.  Instead optimize constant argument case.

	* iconv/gconv.h: Fix typos.

	* iconv/skeleton.c: Fix typos.  Optimize init function a bit.
	Correctly emit escape sequence to return to initial state in
	conversion function.

	* iconvdata/iso-2022-jp.c (gconv_init): Correctly initialize
	max_needed_to element.

	* manual/mbyte.texi: Removed.  This is now described in charset.texi.
	* manual/charset.texi: New file.
	* manual/Makefile (chapters): Replace mbyte by charset.
	* manual/ctype.texi: Document wide character functions.
	* manual/intro.texi: Fix reference to mbyte chapter.
	* manual/lang.texi: Likewise.
	* manual/locale.texi: Likewise.
	* manual/stdio.texi: Likewise.
	* manual/string.texi: Fix @node line for new charset chapter.
	* manual/libc.texinfo (UPDATED): Updated.  Also update copyright years.
	* manual/memory.texi (savestring): Optimize code to give a good
	example.

	* manual/filesys.texi: Fix wording.  Patches by Jim Meyering.

	* nscd/nscd_getgr_r.c: Include stdint.h to get uintptr_t definition.
	* nscd/nscd_getpw_r.c: Likewise.
	* nscd/nscd_gethst_r.c: Likewise.

	* stdlib/stdtold_l.c: Always include xlocale.h.

1999-01-11  Geoffrey Keating  <geoffk@ozemail.com.au>

	* stdlib/fpioconst.h (LDBL_MAX_10_EXP_LOG): Define to be same as
	DBL_MAX_10_EXP_LOG if there is no long double.
	(_fpioconst_pow10): Always use size as LDBL_MAX_10_EXP_LOG to match
	printf_fp.c.

1999-01-10  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* timezone/Makefile ($(testdata)/GB): Changed to ...
	($(testdata)/Europe/London): ... for tst-timezone test.
	($(objpfx)tst-timezone.out): Change GB to Europe/London.

	* timezone/tst-timezone.c (main): Enable DST switching test,
	change GB to Europe/London.

1999-01-10  Philip Blundell  <philb@gnu.org>

	* socket/Makefile (headers): Remove bits/sockunion.h.

1999-01-09  Philip Blundell  <philb@gnu.org>

	* socket/sys/socket.h: Don't include <bits/sockunion.h>.
	* sysdeps/generic/bits/sockunion.h: Deleted.
	* sysdeps/unix/sysv/linux/bits/sockunion.h: Likewise.

1999-01-08  H.J. Lu  <hjl@gnu.org>

	* io/fts.c (fts_close): Don't access memory after having it freed.
Diffstat (limited to 'wctype/wctype.h')
-rw-r--r--wctype/wctype.h108
1 files changed, 61 insertions, 47 deletions
diff --git a/wctype/wctype.h b/wctype/wctype.h
index c4f4f6ca02..0ecb69d6bd 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 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
@@ -166,6 +166,56 @@ extern wctype_t wctype __P ((__const char *__property));
 extern int __iswctype __P ((wint_t __wc, wctype_t __desc));
 extern int iswctype __P ((wint_t __wc, wctype_t __desc));
 
+#if __GNUC__ >= 2 && defined __OPTIMIZE__
+/* The tables are always organized in a way which allows direct access
+   for single byte characters.  */
+extern unsigned int *__ctype32_b;
+
+# define iswalnum(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwalnum) : iswalnum (wc))
+# define iswalpha(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwalpha) : iswalpha (wc))
+# define iswcntrl(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwcntrl) : iswcntrl (wc))
+# define iswdigit(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwdigit) : iswdigit (wc))
+# define iswlower(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwlower) : iswlower (wc))
+# define iswgraph(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwgraph) : iswgraph (wc))
+# define iswprint(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwprint) : iswprint (wc))
+# define iswpunct(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwpunct) : iswpunct (wc))
+# define iswspace(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwspace) : iswspace (wc))
+# define iswupper(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwupper) : iswupper (wc))
+# define iswxdigit(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwxdigit) : iswxdigit (wc))
+
+# ifdef __USE_GNU
+#  define iswblank(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & _ISwblank) : iswblank (wc))
+# endif
+
+# define iswctype(wc, desc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (int) (__ctype32_b[wc] & desc) : iswctype (wc, desc))
+
+#endif	/* gcc && optimizing */
 
 /*
  * Wide-character case-mapping functions: 7.15.3.1.
@@ -184,33 +234,20 @@ extern wint_t towupper __P ((wint_t __wc));
 /* Map the wide character WC using the mapping described by DESC.  */
 extern wint_t __towctrans __P ((wint_t __wc, wctrans_t __desc));
 
-
-# ifndef __NO_WCTYPE
-#  define iswalnum(wc)	__iswctype ((wc), _ISwalnum)
-#  define iswalpha(wc)	__iswctype ((wc), _ISwalpha)
-#  define iswcntrl(wc)	__iswctype ((wc), _ISwcntrl)
-#  define iswdigit(wc)	__iswctype ((wc), _ISwdigit)
-#  define iswlower(wc)	__iswctype ((wc), _ISwlower)
-#  define iswgraph(wc)	__iswctype ((wc), _ISwgraph)
-#  define iswprint(wc)	__iswctype ((wc), _ISwprint)
-#  define iswpunct(wc)	__iswctype ((wc), _ISwpunct)
-#  define iswspace(wc)	__iswctype ((wc), _ISwspace)
-#  define iswupper(wc)	__iswctype ((wc), _ISwupper)
-#  define iswxdigit(wc)	__iswctype ((wc), _ISwxdigit)
-
-#  ifdef __USE_GNU
-#   define iswblank(wc)	__iswctype ((wc), _ISwblank)
-#  endif
-
-
-/* Pointer to conversion tables.  */
+#if __GNUC__ >= 2 && defined __OPTIMIZE__
+/* The tables are always organized in a way which allows direct access
+   for single byte characters.  */
 extern __const __int32_t *__ctype_tolower; /* Case conversions.  */
 extern __const __int32_t *__ctype_toupper; /* Case conversions.  */
 
-#  define towlower(wc)	__towctrans ((wc), __ctype_tolower)
-#  define towupper(wc)	__towctrans ((wc), __ctype_toupper)
+# define towlower(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (wint_t) __ctype_tolower[wc] : towlower (wc))
+# define towuppert(wc) \
+  (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff'	      \
+   ? (wint_t) __ctype_toupper[wc] : towupper (wc))
 
-# endif /* Not __NO_WCTYPE.  */
+#endif	/* gcc && optimizing */
 
 __END_DECLS
 
@@ -317,29 +354,6 @@ extern wint_t __towupper_l __P ((wint_t __wc, __locale_t __locale));
 extern wint_t __towctrans_l __P ((wint_t __wc, wctrans_t __desc,
 				  __locale_t __locale));
 
-
-#  ifndef __NO_WCTYPE
-#   define __iswalnum_l(wc, loc) __iswctype_l ((wc), _ISwalnum, (loc))
-#   define __iswalpha_l(wc, loc) __iswctype_l ((wc), _ISwalpha, (loc))
-#   define __iswcntrl_l(wc, loc) __iswctype_l ((wc), _ISwcntrl, (loc))
-#   define __iswdigit_l(wc, loc) __iswctype_l ((wc), _ISwdigit, (loc))
-#   define __iswlower_l(wc, loc) __iswctype_l ((wc), _ISwlower, (loc))
-#   define __iswgraph_l(wc, loc) __iswctype_l ((wc), _ISwgraph, (loc))
-#   define __iswprint_l(wc, loc) __iswctype_l ((wc), _ISwprint, (loc))
-#   define __iswpunct_l(wc, loc) __iswctype_l ((wc), _ISwpunct, (loc))
-#   define __iswspace_l(wc, loc) __iswctype_l ((wc), _ISwspace, (loc))
-#   define __iswupper_l(wc, loc) __iswctype_l ((wc), _ISwupper, (loc))
-#   define __iswxdigit_l(wc, loc) __iswctype_l ((wc), _ISwxdigit, (loc))
-
-#   define __iswblank_l(wc, loc) __iswctype_l ((wc), _ISwblank, (loc))
-
-#   define __towlower_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_tolower, \
-						(loc))
-#   define __towupper_l(wc, loc) __towctrans_l ((wc), (loc)->__ctype_toupper, \
-						(loc))
-
-#  endif /* Not __NO_WCTYPE.  */
-
 # endif /* Use GNU.  */
 
 __END_DECLS