提交 4c48501e 编写于 作者: R Rich Felker

properly pass current locale to *_l functions when used internally

this change is presently non-functional since the callees do not yet
use their locale argument for anything.
上级 7424ac58
#include <locale.h> #include <locale.h>
#include <langinfo.h> #include <langinfo.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
static const char c_time[] = static const char c_time[] =
...@@ -60,7 +61,7 @@ char *__nl_langinfo_l(nl_item item, locale_t loc) ...@@ -60,7 +61,7 @@ char *__nl_langinfo_l(nl_item item, locale_t loc)
char *__nl_langinfo(nl_item item) char *__nl_langinfo(nl_item item)
{ {
return __nl_langinfo_l(item, 0); return __nl_langinfo_l(item, CURRENT_LOCALE);
} }
weak_alias(__nl_langinfo, nl_langinfo); weak_alias(__nl_langinfo, nl_langinfo);
......
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
int __strcoll_l(const char *l, const char *r, locale_t loc) int __strcoll_l(const char *l, const char *r, locale_t loc)
...@@ -9,7 +10,7 @@ int __strcoll_l(const char *l, const char *r, locale_t loc) ...@@ -9,7 +10,7 @@ int __strcoll_l(const char *l, const char *r, locale_t loc)
int strcoll(const char *l, const char *r) int strcoll(const char *l, const char *r)
{ {
return __strcoll_l(l, r, 0); return __strcoll_l(l, r, CURRENT_LOCALE);
} }
weak_alias(__strcoll_l, strcoll_l); weak_alias(__strcoll_l, strcoll_l);
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <monetary.h> #include <monetary.h>
#include <errno.h> #include <errno.h>
#include "locale_impl.h"
static ssize_t vstrfmon_l(char *s, size_t n, locale_t loc, const char *fmt, va_list ap) static ssize_t vstrfmon_l(char *s, size_t n, locale_t loc, const char *fmt, va_list ap)
{ {
...@@ -93,7 +94,7 @@ ssize_t strfmon(char *restrict s, size_t n, const char *restrict fmt, ...) ...@@ -93,7 +94,7 @@ ssize_t strfmon(char *restrict s, size_t n, const char *restrict fmt, ...)
ssize_t ret; ssize_t ret;
va_start(ap, fmt); va_start(ap, fmt);
ret = vstrfmon_l(s, n, 0, fmt, ap); ret = vstrfmon_l(s, n, CURRENT_LOCALE, fmt, ap);
va_end(ap); va_end(ap);
return ret; return ret;
......
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
/* collate only by code points */ /* collate only by code points */
...@@ -12,7 +13,7 @@ size_t __strxfrm_l(char *restrict dest, const char *restrict src, size_t n, loca ...@@ -12,7 +13,7 @@ size_t __strxfrm_l(char *restrict dest, const char *restrict src, size_t n, loca
size_t strxfrm(char *restrict dest, const char *restrict src, size_t n) size_t strxfrm(char *restrict dest, const char *restrict src, size_t n)
{ {
return __strxfrm_l(dest, src, n, 0); return __strxfrm_l(dest, src, n, CURRENT_LOCALE);
} }
weak_alias(__strxfrm_l, strxfrm_l); weak_alias(__strxfrm_l, strxfrm_l);
#include <wchar.h> #include <wchar.h>
#include <locale.h> #include <locale.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
/* FIXME: stub */ /* FIXME: stub */
...@@ -10,7 +11,7 @@ int __wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale) ...@@ -10,7 +11,7 @@ int __wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale)
int wcscoll(const wchar_t *l, const wchar_t *r) int wcscoll(const wchar_t *l, const wchar_t *r)
{ {
return __wcscoll_l(l, r, 0); return __wcscoll_l(l, r, CURRENT_LOCALE);
} }
weak_alias(__wcscoll_l, wcscoll_l); weak_alias(__wcscoll_l, wcscoll_l);
#include <wchar.h> #include <wchar.h>
#include <locale.h> #include <locale.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
/* collate only by code points */ /* collate only by code points */
...@@ -17,7 +18,7 @@ size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n ...@@ -17,7 +18,7 @@ size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n
size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n) size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n)
{ {
return __wcsxfrm_l(dest, src, n, 0); return __wcsxfrm_l(dest, src, n, CURRENT_LOCALE);
} }
weak_alias(__wcsxfrm_l, wcsxfrm_l); weak_alias(__wcsxfrm_l, wcsxfrm_l);
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <locale.h> #include <locale.h>
#include <time.h> #include <time.h>
#include <limits.h> #include <limits.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
#include "time_impl.h" #include "time_impl.h"
...@@ -263,7 +264,7 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st ...@@ -263,7 +264,7 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm) size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm)
{ {
return __strftime_l(s, n, f, tm, 0); return __strftime_l(s, n, f, tm, CURRENT_LOCALE);
} }
weak_alias(__strftime_l, strftime_l); weak_alias(__strftime_l, strftime_l);
#include <wchar.h> #include <wchar.h>
#include <time.h> #include <time.h>
#include <locale.h> #include <locale.h>
#include "locale_impl.h"
#include "libc.h" #include "libc.h"
const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc); const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
...@@ -64,7 +65,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co ...@@ -64,7 +65,7 @@ size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm) size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
{ {
return __wcsftime_l(wcs, n, f, tm, 0); return __wcsftime_l(wcs, n, f, tm, CURRENT_LOCALE);
} }
weak_alias(__wcsftime_l, wcsftime_l); weak_alias(__wcsftime_l, wcsftime_l);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册