Allow libnosys/sbrk.c to be compiled in a minimal environment.
Nick Clifton
nickc@redhat.com
Wed Apr 30 21:53:00 GMT 2003
Hi Guys,
I am applying the patch below (pre-approved by Jeff) to allow
libgloss/libnosys/sbrk.c to be compiled in a minimal environment,
where not all of the system header files are available. The patch
also fixes up the formatting in the file and changes the return type
of _sbrk() to void * in order to match the prototype in system
header files.
Cheers
Nick
PS. Actually I am only committing the ChangeLog entry, the patch
itself was checked in by accident when I was committing a change for
the xstormy16 port. Sorry about that.
2003-04-29 Nick Clifton <nickc@redhat.com>
* libnosys/sbrk.c: Remove unnecessary #include's.
Change return type of _sbrk() function to void * to match
definition in system header files.
Fix formatting.
--- /notnfs/mcr/req-6109/devo/libgloss/libnosys/sbrk.c 1998-10-06 15:25:31.000000000 -0400
+++ /notnfs/mcr/req-6109/src/libgloss/libnosys/sbrk.c 2003-04-24 08:36:08.000000000 -0400
@@ -1,27 +1,18 @@
-/*
- * Version of sbrk for no operating system.
- */
+/* Version of sbrk for no operating system. */
-#include "config.h"
-#include <_ansi.h>
-#include <_syslist.h>
-#include <sys/types.h>
-#include <errno.h>
-#undef errno
-extern int errno;
-
-caddr_t
-_DEFUN (_sbrk, (incr),
- int incr)
+void *
+_sbrk (incr)
+ int incr;
{
- extern char end; /* set by linker */
- static char *heap_end;
- char *prev_heap_end;
+ extern char end; /* Set by linker. */
+ static char * heap_end;
+ char * prev_heap_end;
+
+ if (heap_end == 0)
+ heap_end = & end;
- if (heap_end == 0) {
- heap_end = &end;
- }
prev_heap_end = heap_end;
heap_end += incr;
- return (caddr_t) prev_heap_end;
+
+ return (void *) prev_heap_end;
}
More information about the Newlib
mailing list