libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libtool-1.5 pre-ANSI replacement


From: Ralf Wildenhues
Subject: [PATCH] libtool-1.5 pre-ANSI replacement
Date: Wed, 8 Sep 2004 14:07:14 +0200
User-agent: Mutt/1.4.1i

Sorry to bring up this ancient topic again, but that memmove infinite
loop really hurts the eyes, even if it might not be used much.  Please
apply to the 1.5 branch if you intend to ever release another update of
that branch.

Regards,
Ralf

2004-09-08  Ralf Wildenhues <address@hidden

        * ltdl.c (memcpy, memmove): Fix pre-ANSI replacement functions
        to not use pointer-to-void arithmetic.
        (memmove): Fix infinite loop.


Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.174.2.7
diff -u -r1.174.2.7 ltdl.c
--- libltdl/ltdl.c      23 Jan 2004 06:04:53 -0000      1.174.2.7
+++ libltdl/ltdl.c      8 Sep 2004 11:51:50 -0000
@@ -386,10 +386,12 @@
      size_t size;
 {
   size_t i = 0;
+  const char *s = src;
+  char *d = dest;
 
   for (i = 0; i < size; ++i)
     {
-      dest[i] = src[i];
+      d[i] = s[i];
     }
 
   return dest;
@@ -410,16 +412,20 @@
      size_t size;
 {
   size_t i;
+  const char *s = src;
+  char *d = dest;
 
-  if (dest < src)
+  if (d < s)
     for (i = 0; i < size; ++i)
       {
-       dest[i] = src[i];
+       d[i] = s[i];
       }
-  else if (dest > src)
-    for (i = size -1; i >= 0; --i)
+  else if (d > s)
+    for (i = size -1; ; --i)
       {
-       dest[i] = src[i];
+       d[i] = s[i];
+       if (i == 0)
+         break;
       }
 
   return dest;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]