Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sbrk.c « libnosys « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8091d70837777af58a12549a1e1dda389976ed4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * 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)
{ 
   extern char end; /* set by linker */
   static char *heap_end; 
   char *prev_heap_end; 

   if (heap_end == 0) { 
      heap_end = &end; 
   } 
   prev_heap_end = heap_end; 
   heap_end += incr; 
   return (caddr_t) prev_heap_end; 
}