summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/wctrans.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/wctrans.c')
-rw-r--r--lib/libc/locale/wctrans.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/lib/libc/locale/wctrans.c b/lib/libc/locale/wctrans.c
index 6813e33..0831146 100644
--- a/lib/libc/locale/wctrans.c
+++ b/lib/libc/locale/wctrans.c
@@ -2,6 +2,11 @@
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -30,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <string.h>
#include <wctype.h>
+#include "xlocale_private.h"
enum {
_WCT_ERROR = 0,
@@ -38,15 +44,14 @@ enum {
};
wint_t
-towctrans(wint_t wc, wctrans_t desc)
+towctrans_l(wint_t wc, wctrans_t desc, locale_t locale)
{
-
switch (desc) {
case _WCT_TOLOWER:
- wc = towlower(wc);
+ wc = towlower_l(wc, locale);
break;
case _WCT_TOUPPER:
- wc = towupper(wc);
+ wc = towupper_l(wc, locale);
break;
case _WCT_ERROR:
default:
@@ -56,9 +61,18 @@ towctrans(wint_t wc, wctrans_t desc)
return (wc);
}
+wint_t
+towctrans(wint_t wc, wctrans_t desc)
+{
+ return towctrans_l(wc, desc, __get_locale());
+}
+/*
+ * wctrans() calls this will a 0 locale. If this is ever modified to actually
+ * use the locale, wctrans() must be modified to call __get_locale().
+ */
wctrans_t
-wctrans(const char *charclass)
+wctrans_l(const char *charclass, locale_t locale)
{
struct {
const char *name;
@@ -78,3 +92,10 @@ wctrans(const char *charclass)
errno = EINVAL;
return (ccls[i].trans);
}
+
+wctrans_t
+wctrans(const char *charclass)
+{
+ return wctrans_l(charclass, 0);
+}
+
OpenPOWER on IntegriCloud