diff options
author | Christopher Faylor <me@cgf.cx> | 2002-09-22 03:38:57 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-09-22 03:38:57 +0000 |
commit | c90e1cf179187d5d188a3003db503ffd86d80cfe (patch) | |
tree | ad0890e2267f00de92aefc5a99d60017e4f15fe9 /winsup/cygwin/heap.cc | |
parent | 228f6b6e07f1b08620dc08f389263f228da0079f (diff) | |
download | cygnal-c90e1cf179187d5d188a3003db503ffd86d80cfe.tar.gz cygnal-c90e1cf179187d5d188a3003db503ffd86d80cfe.tar.bz2 cygnal-c90e1cf179187d5d188a3003db503ffd86d80cfe.zip |
* fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller has
already taken care of that.
* fhandler_console.cc (fhandler_console::open): Initialize handles to NULL.
(fhandler_console::close): Ditto. GNUify non-GNU formatted functions calls
throughout.
Diffstat (limited to 'winsup/cygwin/heap.cc')
-rw-r--r-- | winsup/cygwin/heap.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc index 5c301cc16..139b1d5a0 100644 --- a/winsup/cygwin/heap.cc +++ b/winsup/cygwin/heap.cc @@ -68,7 +68,7 @@ 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, + 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", @@ -86,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; @@ -104,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. @@ -128,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: |