From 0ea569ff6f490556dea024906b3ac69dcde61aac Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Fri, 5 Jun 1998 09:49:51 +0000 Subject: [PATCH] Fix handling more than 1 char with non-C locale Misc. cleanup PR: 6825 Submitted by: Sergey Gershtein --- lib/libc/string/strxfrm.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c index 64b0bcfed50..ecb6d38b5ce 100644 --- a/lib/libc/string/strxfrm.c +++ b/lib/libc/string/strxfrm.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: strxfrm.c,v 1.8 1997/02/22 15:03:31 peter Exp $ */ #include @@ -60,8 +60,8 @@ strxfrm(dest, src, len) return len - 1; } - ss = s = __collate_substitute(src); prim = sec = 0; + ss = s = __collate_substitute(src); while (*s && len > 1) { while (*s && !prim) { __collate_lookup(s, &l, &prim, &sec); @@ -70,23 +70,11 @@ strxfrm(dest, src, len) if (prim) { *d++ = (char)prim; len--; + prim = 0; } } -#if 0 - s = ss; - while (*s && len > 1) { - while (*s && !prim) { - lookup(s, &l, &prim, &sec); - s += l; - } - if (prim && sec) { - *d++ = (char)sec; - len--; - } - } -#endif /* 0 */ - *d = '\0'; free(ss); + *d = '\0'; return d - dest; }