libchill/memmove.c won't compile

Zack Weinberg zack@wolery.cumb.org
Tue May 30 08:47:00 GMT 2000


On Tue, May 30, 2000 at 03:00:18PM +0100, Richard Earnshaw wrote:
> 
> [Arghh!, Maybe this time I've got all the headers right.. ]
> 
> Zack,
> 
> Your patch
> 	2000-05-29  Zack Weinberg  <zack@wolery.cumb.org>
> 
>         * concatstr.c, exh.c: Include stdlib.h and string.h.
>         * delaycase.c, eqstr.c, memmove.c, printbuffer.c,
>         printevent.c, sendbuffer.c, waitbuffer.c: Include string.h.
> 
> breaks a cross build on the ARM with Newlib, since the prototype for 
> memmove in string.h conflicts with the function definition in memove.c
> 
> Why isn't the third argument of memmove (in libchill/memmove.c) of type 
> size_t as required by the standard?

'cos memmove.c didn't have size_t available.  Please try this patch:

	* memmove.c: Include stddef.h.  Change third arg's type to size_t.

===================================================================
Index: memmove.c
--- memmove.c	2000/05/29 19:34:51	1.4
+++ memmove.c	2000/05/30 15:46:38
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.  */
    This exception does not however invalidate any other reasons why
    the executable file might be covered by the GNU General Public License.  */
 
+#include <stddef.h>
 #include <string.h>
 
 #define MIN(a, b)  ((a) < (b) ? (a) : (b))
@@ -54,7 +55,7 @@ void *
 memmove (s1, s2, n)
      void *s1;
      const void *s2;
-     unsigned int n;
+     size_t n;
 {
   char *sc1 = s1;
   const char *sc2 = s2;


More information about the Gcc-bugs mailing list