summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strxfrm.c
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2011-11-22 02:27:59 +0000
committergrehan <grehan@FreeBSD.org>2011-11-22 02:27:59 +0000
commitf68bada80b9371e881d04b43a8ab412fa54cd5fa (patch)
tree97b668c8ce00f69d94b0237dac765c76f460638b /lib/libc/string/strxfrm.c
parentcdc4639328546d2b0ad5a90dd2d4e4534e874c26 (diff)
parent08ecf874bb3cc09a324985ab9315883462c59ae8 (diff)
downloadFreeBSD-src-f68bada80b9371e881d04b43a8ab412fa54cd5fa.zip
FreeBSD-src-f68bada80b9371e881d04b43a8ab412fa54cd5fa.tar.gz
IFC @ r227804
Pull in the virtio drivers from head.
Diffstat (limited to 'lib/libc/string/strxfrm.c')
-rw-r--r--lib/libc/string/strxfrm.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c
index a4c8019..b758b0c 100644
--- a/lib/libc/string/strxfrm.c
+++ b/lib/libc/string/strxfrm.c
@@ -3,6 +3,11 @@
* at Electronni Visti IA, Kiev, Ukraine.
* 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:
@@ -33,11 +38,22 @@ __FBSDID("$FreeBSD$");
#include "collate.h"
size_t
+strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len, locale_t loc);
+size_t
strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
{
+ return strxfrm_l(dest, src, len, __get_locale());
+}
+
+size_t
+strxfrm_l(char * __restrict dest, const char * __restrict src, size_t len, locale_t locale)
+{
int prim, sec, l;
size_t slen;
char *s, *ss;
+ FIX_LOCALE(locale);
+ struct xlocale_collate *table =
+ (struct xlocale_collate*)locale->components[XLC_COLLATE];
if (!*src) {
if (len > 0)
@@ -45,15 +61,15 @@ strxfrm(char * __restrict dest, const char * __restrict src, size_t len)
return 0;
}
- if (__collate_load_error)
+ if (table->__collate_load_error)
return strlcpy(dest, src, len);
slen = 0;
prim = sec = 0;
- ss = s = __collate_substitute(src);
+ ss = s = __collate_substitute(table, src);
while (*s) {
while (*s && !prim) {
- __collate_lookup(s, &l, &prim, &sec);
+ __collate_lookup(table, s, &l, &prim, &sec);
s += l;
}
if (prim) {
OpenPOWER on IntegriCloud