* 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.
This commit is contained in:
Christopher Faylor
2002-09-22 03:38:57 +00:00
parent 228f6b6e07
commit c90e1cf179
43 changed files with 250 additions and 235 deletions

View File

@ -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: