This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Rename __get_locale_XXX to __get_XXX_locale to use unified naming scheme


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=542b970d4e09d74fd0a6d8787b9d82efe352c033

commit 542b970d4e09d74fd0a6d8787b9d82efe352c033
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Jul 25 11:24:59 2016 +0200

    Rename __get_locale_XXX to __get_XXX_locale to use unified naming scheme
    
    Signed-off by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/libc/locale/setlocale.h | 48 +++++++++++++++++++++++++++++++-----------
 newlib/libc/time/strftime.c    |  2 +-
 winsup/cygwin/nlsfuncs.cc      | 12 +++++------
 3 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
index 6885c3a..d63a13f 100644
--- a/newlib/libc/locale/setlocale.h
+++ b/newlib/libc/locale/setlocale.h
@@ -225,7 +225,7 @@ __get_current_locale ()
 
 #ifdef __CYGWIN__
 _ELIDABLE_INLINE const struct lc_collate_T *
-__get_locale_collate (struct __locale_t *locale)
+__get_collate_locale (struct __locale_t *locale)
 {
   return (const struct lc_collate_T *) locale->lc_cat[LC_COLLATE].ptr;
 }
@@ -233,12 +233,13 @@ __get_locale_collate (struct __locale_t *locale)
 _ELIDABLE_INLINE const struct lc_collate_T *
 __get_current_collate_locale (void)
 {
-  return (const struct lc_collate_T *) __get_current_locale ()->lc_cat[LC_COLLATE].ptr;
+  return (const struct lc_collate_T *)
+	 __get_current_locale ()->lc_cat[LC_COLLATE].ptr;
 }
 #endif
 
 _ELIDABLE_INLINE const struct lc_ctype_T *
-__get_locale_ctype (struct __locale_t *locale)
+__get_ctype_locale (struct __locale_t *locale)
 {
   return (const struct lc_ctype_T *) (locale)->lc_cat[LC_CTYPE].ptr;
 }
@@ -247,7 +248,7 @@ _ELIDABLE_INLINE int
 __locale_mb_cur_max_l (struct __locale_t *locale)
 {
 #ifdef __HAVE_LOCALE_INFO__
-  return __get_locale_ctype (locale)->mb_cur_max[0];
+  return __get_ctype_locale (locale)->mb_cur_max[0];
 #else
   return locale->mb_cur_max[0];
 #endif
@@ -256,37 +257,60 @@ __locale_mb_cur_max_l (struct __locale_t *locale)
 _ELIDABLE_INLINE const struct lc_ctype_T *
 __get_current_ctype_locale (void)
 {
-  return (const struct lc_ctype_T *) __get_current_locale ()->lc_cat[LC_CTYPE].ptr;
+  return (const struct lc_ctype_T *)
+	 __get_current_locale ()->lc_cat[LC_CTYPE].ptr;
+}
+
+_ELIDABLE_INLINE const struct lc_monetary_T *
+__get_monetary_locale (struct __locale_t *locale)
+{
+  return (const struct lc_monetary_T *) (locale)->lc_cat[LC_MONETARY].ptr;
 }
 
 _ELIDABLE_INLINE const struct lc_monetary_T *
 __get_current_monetary_locale (void)
 {
-  return (const struct lc_monetary_T *) __get_current_locale ()->lc_cat[LC_MONETARY].ptr;
+  return (const struct lc_monetary_T *)
+	 __get_current_locale ()->lc_cat[LC_MONETARY].ptr;
+}
+
+_ELIDABLE_INLINE const struct lc_numeric_T *
+__get_numeric_locale (struct __locale_t *locale)
+{
+  return (const struct lc_numeric_T *) (locale)->lc_cat[LC_NUMERIC].ptr;
 }
 
 _ELIDABLE_INLINE const struct lc_numeric_T *
 __get_current_numeric_locale (void)
 {
-  return (const struct lc_numeric_T *) __get_current_locale ()->lc_cat[LC_NUMERIC].ptr;
+  return (const struct lc_numeric_T *)
+	 __get_current_locale ()->lc_cat[LC_NUMERIC].ptr;
+}
+
+_ELIDABLE_INLINE const struct lc_time_T *
+__get_time_locale (struct __locale_t *locale)
+{
+  return (const struct lc_time_T *) (locale)->lc_cat[LC_TIME].ptr;
 }
 
 _ELIDABLE_INLINE const struct lc_time_T *
 __get_current_time_locale (void)
 {
-  return (const struct lc_time_T *) __get_current_locale ()->lc_cat[LC_TIME].ptr;
+  return (const struct lc_time_T *)
+	 __get_current_locale ()->lc_cat[LC_TIME].ptr;
 }
 
-_ELIDABLE_INLINE const struct lc_ctype_T *
-__get_locale_time (struct __locale_t *locale)
+_ELIDABLE_INLINE const struct lc_messages_T *
+__get_messages_locale (struct __locale_t *locale)
 {
-  return (const struct lc_time_T *) (locale)->lc_cat[LC_TIME].ptr;
+  return (const struct lc_messages_T *) (locale)->lc_cat[LC_MESSAGES].ptr;
 }
 
 _ELIDABLE_INLINE const struct lc_messages_T *
 __get_current_messages_locale (void)
 {
-  return (const struct lc_messages_T *) __get_current_locale ()->lc_cat[LC_MESSAGES].ptr;
+  return (const struct lc_messages_T *)
+	 __get_current_locale ()->lc_cat[LC_MESSAGES].ptr;
 }
 
 _ELIDABLE_INLINE const char *
diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c
index 0d5bbd5..9ff44f9 100644
--- a/newlib/libc/time/strftime.c
+++ b/newlib/libc/time/strftime.c
@@ -698,7 +698,7 @@ __strftime (CHAR *s, size_t maxsize, const CHAR *format,
   unsigned long width;
   int tzset_called = 0;
 
-  const struct lc_time_T *_CurrentTimeLocale = __get_locale_time (locale);
+  const struct lc_time_T *_CurrentTimeLocale = __get_time_locale (locale);
   for (;;)
     {
       while (*format && *format != CQ('%'))
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index 7145771..9ff1ef2 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -1121,7 +1121,7 @@ wcscoll_l (const wchar_t *__restrict ws1, const wchar_t *__restrict ws2,
 	   struct __locale_t *locale)
 {
   int ret;
-  LCID collate_lcid = __get_locale_collate (locale)->lcid;
+  LCID collate_lcid = __get_collate_locale (locale)->lcid;
 
   if (!collate_lcid)
     return wcscmp (ws1, ws2);
@@ -1145,13 +1145,13 @@ strcoll_l (const char *__restrict s1, const char *__restrict s2,
   wchar_t *ws1, *ws2;
   tmp_pathbuf tp;
   int ret;
-  LCID collate_lcid = __get_locale_collate (locale)->lcid;
+  LCID collate_lcid = __get_collate_locale (locale)->lcid;
 
   if (!collate_lcid)
     return strcmp (s1, s2);
   /* The ANSI version of CompareString uses the default charset of the lcid,
      so we must use the Unicode version. */
-  mbtowc_p collate_mbtowc = __get_locale_collate (locale)->mbtowc;
+  mbtowc_p collate_mbtowc = __get_collate_locale (locale)->mbtowc;
   n1 = lc_mbstowcs (collate_mbtowc, NULL, s1, 0) + 1;
   ws1 = (n1 > NT_MAX_PATH ? (wchar_t *) malloc (n1 * sizeof (wchar_t))
 			  : tp.w_get ());
@@ -1192,7 +1192,7 @@ wcsxfrm_l (wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t wsn,
 	   struct __locale_t *locale)
 {
   size_t ret;
-  LCID collate_lcid = __get_locale_collate (locale)->lcid;
+  LCID collate_lcid = __get_collate_locale (locale)->lcid;
 
   if (!collate_lcid)
     return wcslcpy (ws1, ws2, wsn);
@@ -1235,13 +1235,13 @@ strxfrm_l (char *__restrict s1, const char *__restrict s2, size_t sn,
   size_t n2;
   wchar_t *ws2;
   tmp_pathbuf tp;
-  LCID collate_lcid = __get_locale_collate (locale)->lcid;
+  LCID collate_lcid = __get_collate_locale (locale)->lcid;
 
   if (!collate_lcid)
     return strlcpy (s1, s2, sn);
   /* The ANSI version of LCMapString uses the default charset of the lcid,
      so we must use the Unicode version. */
-  mbtowc_p collate_mbtowc = __get_locale_collate (locale)->mbtowc;
+  mbtowc_p collate_mbtowc = __get_collate_locale (locale)->mbtowc;
   n2 = lc_mbstowcs (collate_mbtowc, NULL, s2, 0) + 1;
   ws2 = (n2 > NT_MAX_PATH ? (wchar_t *) malloc (n2 * sizeof (wchar_t))
 			  : tp.w_get ());


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]