* memchr.c (memchr): Adjust condition to avoid infinite loop.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 28 Mar 2001 04:10:24 +0000 (04:10 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 28 Mar 2001 04:10:24 +0000 (04:10 +0000)
From-SVN: r40899

libiberty/ChangeLog
libiberty/memchr.c

index 7a1e8268551c7e0f788eb54a216700c772f215fe..f4ec6e15c2f7286dbd986e65d20ae9c557b07e7e 100644 (file)
@@ -1,3 +1,7 @@
+2001-03-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * memchr.c (memchr): Adjust condition to avoid infinite loop.
+
 2001-03-23  Jakub Jelinek  <jakub@redhat.com>
 
        * cp-demangle.c (demangle_discriminator): `_0' is discriminator #1,
index cce300394375b0e28ae1ad40b3f034fdbc1a0b47..89aa98f1d94662b9e194ce90177b0e8e9db9a24b 100644 (file)
@@ -50,7 +50,7 @@ memchr (src_void, c, length)
 {
   const unsigned char *src = (const unsigned char *)src_void;
   
-  while (--length >= 0)
+  while (length-- > 0)
   {
     if (*src == c)
      return (PTR)src;