]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltdl.c (memcpy, memmove): Fix pre-ANSI replacement functions
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 13 Sep 2004 12:56:00 +0000 (12:56 +0000)
committerGary V. Vaughan <gary@gnu.org>
Mon, 13 Sep 2004 12:56:00 +0000 (12:56 +0000)
to not use pointer-to-void arithmetic.
(memmove): Fix infinite loop.

ChangeLog
libltdl/ltdl.c

index c709de63dac60f389ac4df39df4dc5d72f5a743d..2526fd3cb34e331f79eb34256d0c7a5d725306cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * ltdl.c (memcpy, memmove): Fix pre-ANSI replacement functions
+       to not use pointer-to-void arithmetic.
+       (memmove): Fix infinite loop.
+
 2004-09-12  Brad <brad@comstyle.com>
 
        * libtool.m4: Fixes for the OpenBSD support
@@ -58,7 +64,7 @@
 
 2004-08-01  Maciej W. Rozycki  <macro@linux-mips.org>
 
-       * libtool.m4 (LT_AC_PROG_SED): Set SED when running from cache as 
+       * libtool.m4 (LT_AC_PROG_SED): Set SED when running from cache as
        well.
 
 2004-07-30  Peter O'Gorman  <peter@pogma.com>
@@ -78,7 +84,7 @@
 
 2004-07-22  Joe Orton  <joe@manyfish.co.uk>
 
-       * libtool.m4: Treat bsdi5* like bsdi4*. 
+       * libtool.m4: Treat bsdi5* like bsdi4*.
 
 2004-07-08  Peter O'Gorman  <peter@pogma.com>
 
index 5ea74635a58da2c3041640ceb7955355a00f356f..cd99acceb8a83733717daeb1d3edcddb2552db67 100644 (file)
@@ -1,5 +1,5 @@
 /* ltdl.c -- system independent dlopen wrapper
-   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
    Originally by Thomas Tanner <tanner@ffii.org>
    This file is part of GNU Libtool.
 
@@ -385,11 +385,13 @@ memcpy (dest, src, size)
      const lt_ptr src;
      size_t size;
 {
-  size_t i = 0;
+  const char * s = src;
+  char *       d = dest;
+  size_t       i = 0;
 
   for (i = 0; i < size; ++i)
     {
-      dest[i] = src[i];
+      d[i] = s[i];
     }
 
   return dest;
@@ -409,17 +411,21 @@ memmove (dest, src, size)
      const lt_ptr src;
      size_t size;
 {
-  size_t i;
+  const char * s = src;
+  char *       d = dest;
+  size_t       i;
 
-  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 && size > 0)
+    for (i = size -1; ; --i)
       {
-       dest[i] = src[i];
+       d[i] = s[i];
+       if (i == 0)
+         break;
       }
 
   return dest;