summary refs log tree commit diff
path: root/string/strxfrm_l.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-10-15 20:51:49 +0000
committerUlrich Drepper <drepper@redhat.com>2005-10-15 20:51:49 +0000
commitbc3a45cef800af2281deb54e5be0278a2f153efc (patch)
treea00032dc50843eb07682d19157943ee49cd5daba /string/strxfrm_l.c
parentb7cd53255606e8cd0030319df6b366afd86979bd (diff)
downloadglibc-bc3a45cef800af2281deb54e5be0278a2f153efc.tar.gz
glibc-bc3a45cef800af2281deb54e5be0278a2f153efc.tar.xz
glibc-bc3a45cef800af2281deb54e5be0278a2f153efc.zip
[BZ #968]
	* string/strxfrm_l.c (STRXFRM): Fix exit conditions of two loops.
Diffstat (limited to 'string/strxfrm_l.c')
-rw-r--r--string/strxfrm_l.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
index 44b605168a..5335601919 100644
--- a/string/strxfrm_l.c
+++ b/string/strxfrm_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,96,97,2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -210,8 +210,9 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
 		      /* Handle the pushed elements now.  */
 		      size_t backw;
 
-		      for (backw = idxcnt - 1; backw >= backw_stop; --backw)
+		      for (backw = idxcnt; backw > backw_stop; )
 			{
+			  --backw;
 			  len = weights[idxarr[backw]++];
 
 			  if (needed + len < n)
@@ -293,8 +294,9 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
 		     /* Handle the pushed elements now.  */
 		      size_t backw;
 
-		      for (backw = idxcnt - 1; backw >= backw_stop; --backw)
+		      for (backw = idxcnt; backw > backw_stop; )
 			{
+			  --backw;
 			  len = weights[idxarr[backw]++];
 			  if (len != 0)
 			    {