]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - wcsmbs/wcsmbsload.h
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / wcsmbs / wcsmbsload.h
index 6aa6139f777154f370452ed7c9ce7c6475c934ee..10a10b961c19eb4172d5d1e3d0681c84694632e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _WCSMBSLOAD_H
+#define _WCSMBSLOAD_H  1
 
 #include <locale.h>
 #include <wchar.h>
@@ -32,31 +34,46 @@ struct gconv_fcts
   };
 
 /* Set of currently active conversion functions.  */
-extern struct gconv_fcts __wcsmbs_gconv_fcts;
-
-
-/* Last loaded locale for LC_CTYPE.  */
-extern const struct locale_data *__wcsmbs_last_locale;
-
+extern const struct gconv_fcts __wcsmbs_gconv_fcts_c attribute_hidden;
 
 /* Load conversion functions for the currently selected locale.  */
-extern void __wcsmbs_load_conv (const struct locale_data *new_category)
-     internal_function;
+extern void __wcsmbs_load_conv (struct __locale_data *new_category)
+     attribute_hidden;
 
 /* Clone the current `__wcsmbs_load_conv' value.  */
 extern void __wcsmbs_clone_conv (struct gconv_fcts *copy)
-     internal_function;
+     attribute_hidden;
 
 /* Find the conversion functions for converting to and from NAME.  */
 extern int __wcsmbs_named_conv (struct gconv_fcts *copy, const char *name)
-     internal_function;
+     attribute_hidden;
+
+/* Function used for the `private.cleanup' hook.  */
+extern void _nl_cleanup_ctype (struct __locale_data *) attribute_hidden;
 
 
+#include <iconv/gconv_int.h>
+
+
+/* Load the function implementation if necessary.  */
+extern struct __gconv_step *__wcsmbs_getfct (const char *to, const char *from,
+                                            size_t *nstepsp)
+     attribute_hidden;
+
+extern const struct __locale_data _nl_C_LC_CTYPE attribute_hidden;
+
 /* Check whether the LC_CTYPE locale changed since the last call.
    Update the pointers appropriately.  */
-static inline void
-update_conversion_ptrs (void)
+static inline const struct gconv_fcts *
+get_gconv_fcts (struct __locale_data *data)
 {
-  if (__wcsmbs_last_locale != _nl_current_LC_CTYPE)
-    __wcsmbs_load_conv (_nl_current_LC_CTYPE);
+  if (__glibc_unlikely (data->private.ctype == NULL))
+    {
+      if (__glibc_unlikely (data == &_nl_C_LC_CTYPE))
+       return &__wcsmbs_gconv_fcts_c;
+      __wcsmbs_load_conv (data);
+    }
+  return data->private.ctype;
 }
+
+#endif /* wcsmbsload.h */