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

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/heap.cc')
-rw-r--r--winsup/cygwin/heap.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc
index eaa500c62..139b1d5a0 100644
--- a/winsup/cygwin/heap.cc
+++ b/winsup/cygwin/heap.cc
@@ -1,6 +1,6 @@
/* heap.cc: Cygwin heap manager.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -11,7 +11,6 @@ details. */
#include "winsup.h"
#include <errno.h>
#include "cygerrno.h"
-#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "heap.h"
@@ -69,15 +68,15 @@ heap_init ()
/* Initialize page mask and default heap size. Preallocate a heap
* to assure contiguous memory. */
cygheap->heapptr = cygheap->heaptop = cygheap->heapbase =
- VirtualAlloc(NULL, cygwin_shared->heap_chunk_size (), MEM_RESERVE,
- PAGE_NOACCESS);
+ VirtualAlloc (NULL, cygwin_shared->heap_chunk_size (), MEM_RESERVE,
+ PAGE_NOACCESS);
if (cygheap->heapbase == NULL)
api_fatal ("2. unable to allocate heap, heap_chunk_size %d, %E",
cygwin_shared->heap_chunk_size ());
}
debug_printf ("heap base %p, heap top %p", cygheap->heapbase,
- cygheap->heaptop);
+ cygheap->heaptop);
page_const--;
malloc_init ();
}
@@ -87,7 +86,7 @@ heap_init ()
/* FIXME: This function no longer handles "split heaps". */
extern "C" void *
-_sbrk(int n)
+_sbrk (int n)
{
sigframe thisframe (mainthread);
char *newtop, *newbrk;
@@ -105,21 +104,21 @@ _sbrk(int n)
if (n < 0)
{ /* Freeing memory */
- assert(newtop < cygheap->heaptop);
+ assert (newtop < cygheap->heaptop);
n = (char *) cygheap->heaptop - newtop;
- if (VirtualFree(newtop, n, MEM_DECOMMIT)) /* Give it back to OS */
+ if (VirtualFree (newtop, n, MEM_DECOMMIT)) /* Give it back to OS */
goto good; /* Didn't take */
else
goto err;
}
- assert(newtop > cygheap->heaptop);
+ assert (newtop > cygheap->heaptop);
/* Need to grab more pages from the OS. If this fails it may be because
* we have used up previously reserved memory. Or, we're just plumb out
* of memory. */
commitbytes = pround (newtop - (char *) cygheap->heaptop);
- if (VirtualAlloc(cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL)
+ if (VirtualAlloc (cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL)
goto good;
/* Couldn't allocate memory. Maybe we can reserve some more.
@@ -129,8 +128,8 @@ _sbrk(int n)
if ((newbrksize = cygwin_shared->heap_chunk_size ()) < commitbytes)
newbrksize = commitbytes;
- if ((VirtualAlloc(cygheap->heaptop, newbrksize, MEM_RESERVE, PAGE_NOACCESS) != NULL) &&
- (VirtualAlloc(cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL))
+ if ((VirtualAlloc (cygheap->heaptop, newbrksize, MEM_RESERVE, PAGE_NOACCESS) != NULL) &&
+ (VirtualAlloc (cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL))
goto good;
err: