Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add localeconv_l.



details:   https://anonhg.NetBSD.org/src/rev/06ec0c0a02ad
branches:  trunk
changeset: 786166:06ec0c0a02ad
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Apr 17 20:40:13 2013 +0000

description:
Add localeconv_l.

diffstat:

 include/locale.h             |  24 ++++++++++++++++++------
 lib/libc/locale/localeconv.c |  12 ++++++++++--
 2 files changed, 28 insertions(+), 8 deletions(-)

diffs (74 lines):

diff -r be63f3e3156a -r 06ec0c0a02ad include/locale.h
--- a/include/locale.h  Wed Apr 17 20:29:16 2013 +0000
+++ b/include/locale.h  Wed Apr 17 20:40:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locale.h,v 1.18 2013/04/14 23:30:15 joerg Exp $        */
+/*     $NetBSD: locale.h,v 1.19 2013/04/17 20:40:13 joerg Exp $        */
 
 /*
  * Copyright (c) 1991, 1993
@@ -75,17 +75,29 @@
 
 #include <sys/cdefs.h>
 
-#ifdef __SETLOCALE_SOURCE__
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) || \
+    defined(__SETLOCALE_SOURCE__)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale         *locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+#endif
 
-typedef struct _locale         *_locale_t;
-
-#define _LC_GLOBAL_LOCALE      ((_locale_t)-1)
-
+#ifdef __SETLOCALE_SOURCE__
+#define _LC_GLOBAL_LOCALE      ((locale_t)-1)
 #endif
 
 __BEGIN_DECLS
 struct lconv *localeconv(void);
 char *setlocale(int, const char *) __RENAME(__setlocale50);
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+#  ifndef __LOCALE_T_DECLARED
+typedef struct _locale         *locale_t;
+#  define __LOCALE_T_DECLARED
+#  endif
+struct lconv   *localeconv_l(locale_t);
+#endif
 __END_DECLS
 
 #endif /* _LOCALE_H_ */
diff -r be63f3e3156a -r 06ec0c0a02ad lib/libc/locale/localeconv.c
--- a/lib/libc/locale/localeconv.c      Wed Apr 17 20:29:16 2013 +0000
+++ b/lib/libc/locale/localeconv.c      Wed Apr 17 20:40:13 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: localeconv.c,v 1.19 2012/06/24 15:26:03 christos Exp $ */
+/* $NetBSD: localeconv.c,v 1.20 2013/04/17 20:40:13 joerg Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: localeconv.c,v 1.19 2012/06/24 15:26:03 christos Exp $");
+__RCSID("$NetBSD: localeconv.c,v 1.20 2013/04/17 20:40:13 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -43,3 +43,11 @@
 {
        return _current_cache()->ldata;
 }
+
+struct lconv *
+localeconv_l(locale_t loc)
+{
+       if (loc == NULL)
+               loc = _C_locale;
+       return loc->cache->ldata;
+}



Home | Main Index | Thread Index | Old Index