diff options
author | ache <ache@FreeBSD.org> | 1998-06-05 09:49:51 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1998-06-05 09:49:51 +0000 |
commit | 2682c4a8c81dca751cedda45f4d523c6fb3aab02 (patch) | |
tree | 710caa0ea30d6eda629185ba664a8e1758c35f52 | |
parent | 9f8f6862d0b3f5f137901a70e3d8bf05a0ba0048 (diff) | |
download | FreeBSD-src-2682c4a8c81dca751cedda45f4d523c6fb3aab02.zip FreeBSD-src-2682c4a8c81dca751cedda45f4d523c6fb3aab02.tar.gz |
Fix handling more than 1 char with non-C locale
Misc. cleanup
PR: 6825
Submitted by: Sergey Gershtein <sg@mplik.ru>
-rw-r--r-- | lib/libc/string/strxfrm.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c index 64b0bcf..ecb6d38 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 <stdlib.h> @@ -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; } |