about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-02 21:04:06 +0000
committerRoland McGrath <roland@gnu.org>2002-08-02 21:04:06 +0000
commit174d73a3bad55f7359c49c82474e9991871d0e2f (patch)
tree2bec465ea339c2c3a5c634b1e3c08a655db04f94
parentae309ba9e4f88118c23cd925cef2d457a42f4404 (diff)
downloadglibc-174d73a3bad55f7359c49c82474e9991871d0e2f.tar.gz
glibc-174d73a3bad55f7359c49c82474e9991871d0e2f.tar.xz
glibc-174d73a3bad55f7359c49c82474e9991871d0e2f.zip
2002-08-02 Roland McGrath <roland@redhat.com>
	* locale/localeinfo.h (_NL_CURRENT_DATA): New macro.
	* wcsmbs/wcsmbsload.h (update_conversion_ptrs): Use it.
	* locale/lc-ctype.c (_nl_postload_ctype): Likewise.
	* wctype/wctrans.c (wctrans): Likewise.
	* wctype/wctype.c (__wctype): Likewise.
	* intl/loadmsgcat.c (_nl_init_domain_conv): Use _NL_CURRENT.
-rw-r--r--intl/loadmsgcat.c2
-rw-r--r--locale/lc-ctype.c6
-rw-r--r--locale/localeinfo.h6
-rw-r--r--wcsmbs/wcsmbsload.h4
-rw-r--r--wctype/wctrans.c6
-rw-r--r--wctype/wctype.c6
6 files changed, 18 insertions, 12 deletions
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 19a3e9b8e5..b9e59f5682 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -805,7 +805,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding)
 	      if (outcharset == NULL || outcharset[0] == '\0')
 		{
 # ifdef _LIBC
-		  outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string;
+		  outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
 # else
 #  if HAVE_ICONV
 		  extern const char *locale_charset (void);
diff --git a/locale/lc-ctype.c b/locale/lc-ctype.c
index 3fc23948c6..59ff7019aa 100644
--- a/locale/lc-ctype.c
+++ b/locale/lc-ctype.c
@@ -34,6 +34,8 @@ _NL_CURRENT_DEFINE (LC_CTYPE);
 void
 _nl_postload_ctype (void)
 {
+  const struct locale_data *data = _NL_CURRENT_DATA (LC_CTYPE);
+
 #define paste(a,b) paste1(a,b)
 #define paste1(a,b) a##b
 
@@ -58,11 +60,11 @@ _nl_postload_ctype (void)
 
   offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET);
   for (cnt = 0; cnt < 12; cnt++)
-    __ctype32_wctype[cnt] = _nl_current_LC_CTYPE->values[offset + cnt].string;
+    __ctype32_wctype[cnt] = data->values[offset + cnt].string;
 
   offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET);
   for (cnt = 0; cnt < 2; cnt++)
-    __ctype32_wctrans[cnt] = _nl_current_LC_CTYPE->values[offset + cnt].string;
+    __ctype32_wctrans[cnt] = data->values[offset + cnt].string;
 
   __ctype32_width = current (char, WIDTH, 0);
 }
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 2074569811..3a43469c84 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -158,13 +158,17 @@ extern const char _nl_POSIX_name[] attribute_hidden;
 /* The standard codeset.  */
 extern const char _nl_C_codeset[] attribute_hidden;
 
+/* Return a pointer to the current `struct locale_data' for CATEGORY.  */
+#define _NL_CURRENT_DATA(category)	\
+  ((const struct locale_data *) _nl_current_##category)
+
 /* Extract the current CATEGORY locale's string for ITEM.  */
 #define _NL_CURRENT(category, item) \
   (_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
 
 /* Extract the current CATEGORY locale's string for ITEM.  */
 #define _NL_CURRENT_WSTR(category, item) \
-  ((wchar_t *) (_nl_current_##category->values[_NL_ITEM_INDEX (item)].wstr))
+  ((wchar_t *) _nl_current_##category->values[_NL_ITEM_INDEX (item)].wstr)
 
 /* Extract the current CATEGORY locale's word for ITEM.  */
 #define _NL_CURRENT_WORD(category, item) \
diff --git a/wcsmbs/wcsmbsload.h b/wcsmbs/wcsmbsload.h
index dee2c815c2..1fcb42c033 100644
--- a/wcsmbs/wcsmbsload.h
+++ b/wcsmbs/wcsmbsload.h
@@ -57,6 +57,6 @@ extern int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
 static inline void
 update_conversion_ptrs (void)
 {
-  if (__wcsmbs_last_locale != _nl_current_LC_CTYPE)
-    __wcsmbs_load_conv (_nl_current_LC_CTYPE);
+  if (__wcsmbs_last_locale != _NL_CURRENT_DATA (LC_CTYPE))
+    __wcsmbs_load_conv (_NL_CURRENT_DATA (LC_CTYPE));
 }
diff --git a/wctype/wctrans.c b/wctype/wctrans.c
index 4384c7b2f8..0f921efd0a 100644
--- a/wctype/wctrans.c
+++ b/wctype/wctrans.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996,97,99,2000,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -44,5 +44,5 @@ wctrans (const char *property)
     return 0;
 
   i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + cnt;
-  return (wctrans_t) _nl_current_LC_CTYPE->values[i].string;
+  return (wctrans_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
 }
diff --git a/wctype/wctype.c b/wctype/wctype.c
index fc1927c450..9168929282 100644
--- a/wctype/wctype.c
+++ b/wctype/wctype.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996,97,98,2000,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+   Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -44,6 +44,6 @@ __wctype (const char *property)
     }
 
   i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + result;
-  return (wctype_t) _nl_current_LC_CTYPE->values[i].string;
+  return (wctype_t) _NL_CURRENT_DATA (LC_CTYPE)->values[i].string;
 }
 weak_alias (__wctype, wctype)