[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gsl] [PATCH] Use the standard signature for memcpy and memmove
From: |
Giuseppe Scrivano |
Subject: |
[Bug-gsl] [PATCH] Use the standard signature for memcpy and memmove |
Date: |
Sat, 10 Apr 2010 14:57:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Hello,
the attached patch fixes a compiler warning.
This is the gcc version I have used on a i686 GNU/Linux system:
$ gcc --version
gcc (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)
Cheers,
Giuseppe
>From dafc362a6d7979f4fe68c6376bc1dc783671b957 Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Sat, 10 Apr 2010 14:48:38 +0200
Subject: [PATCH] Use the standard signature for memcpy and memmove
---
ChangeLog | 8 +++++++-
utils/memcpy.c | 16 ++++++++--------
utils/memmove.c | 12 ++++++++----
3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0d43ff0..0bf700f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-10 Giuseppe Scrivano <address@hidden>
+
+ * utils/memcpy.c (memcpy): Use the standand method signature.
+
+ * utils/memmove.c (memmove): Likewise.
+
2010-01-18 Brian Gough <address@hidden>
* gsl_version.h.in, configure.ac: added GSL_MAJOR_VERSION and
@@ -7,7 +13,7 @@
* configure.ac: added RETURN_IF_NULL macro to handle null argument
in free() type functions.
-
+
2009-05-09 Brian Gough <address@hidden>
* configure.ac: improve tests for C99 inline, and don't test when
diff --git a/utils/memcpy.c b/utils/memcpy.c
index 61dd912..4f29333 100644
--- a/utils/memcpy.c
+++ b/utils/memcpy.c
@@ -6,15 +6,15 @@
#include <config.h>
#endif
-char *
+void *
memcpy (destaddr, srcaddr, len)
- char *destaddr;
- const char *srcaddr;
- int len;
+ void *destaddr;
+ const void *srcaddr;
+ unsigned int len;
{
- char *dest = destaddr;
-
+ char *dest = (char *) destaddr;
+ const char *src = srcaddr;
while (len-- > 0)
- *destaddr++ = *srcaddr++;
- return dest;
+ *dest++ = *src++;
+ return destaddr;
}
diff --git a/utils/memmove.c b/utils/memmove.c
index c374698..5615f5b 100644
--- a/utils/memmove.c
+++ b/utils/memmove.c
@@ -7,12 +7,14 @@
#include <config.h>
#endif
-void
-memmove (dest, source, length)
- char *dest;
- const char *source;
+void *
+memmove (destaddr, sourceaddr, length)
+ void *destaddr;
+ const void *sourceaddr;
unsigned length;
{
+ char *dest = destaddr;
+ const char *source = sourceaddr;
if (source < dest)
/* Moving from low mem to hi mem; start at end. */
for (source += length, dest += length; length; --length)
@@ -21,4 +23,6 @@ memmove (dest, source, length)
/* Moving from hi mem to low mem; start at beginning. */
for (; length; --length)
*dest++ = *source++;
+
+ return destaddr;
}
--
1.7.0
- [Bug-gsl] [PATCH] Use the standard signature for memcpy and memmove,
Giuseppe Scrivano <=