[ob/fix] libc/stdio/fread.c: Include malloc.h

Corinna Vinschen vinschen@redhat.com
Fri Sep 24 15:49:00 GMT 2004


the latest patch to fread.c uses FREEUB.  This is defined in
libc/stdio/local.h and calls _free_r().  _free_r doesn't exist on
Cygwin and is therefore defined as free in stdlib.h as well as in
malloc.h.  Unfortunately, none of these files is included in
fread.c, nor in local.h so this patch breaks Cygwin.

I've applied the obvious fix below.  Perhaps, long-term it would
be better to include stdlib.h or malloc.h in local.h.


	* libc/stdio/fread.c (fread): Include <malloc.h>.

Index: libc/stdio/fread.c
RCS file: /cvs/src/src/newlib/libc/stdio/fread.c,v
retrieving revision 1.6
diff -p -u -r1.6 fread.c
--- libc/stdio/fread.c  22 Sep 2004 21:22:07 -0000      1.6
+++ libc/stdio/fread.c  24 Sep 2004 09:07:08 -0000
@@ -58,6 +58,7 @@ Supporting OS subroutines required: <<cl
 #include <_ansi.h>
 #include <stdio.h>
 #include <string.h>
+#include <malloc.h>
 #include "local.h"
 #ifdef __SCLE

Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.

More information about the Newlib mailing list