comparison src/gmalloc.c @ 288:e11d67e05968 r21-0b42

Import from CVS: tag r21-0b42
author cvs
date Mon, 13 Aug 2007 10:35:54 +0200
parents c42ec1d1cded
children 74fd4e045ea6
comparison
equal deleted inserted replaced
287:13a0bd77a29d 288:e11d67e05968
498 while ((__malloc_size_t) BLOCK ((char *) result + size) > newsize) 498 while ((__malloc_size_t) BLOCK ((char *) result + size) > newsize)
499 newsize *= 2; 499 newsize *= 2;
500 newinfo = (malloc_info *) align (newsize * sizeof (malloc_info)); 500 newinfo = (malloc_info *) align (newsize * sizeof (malloc_info));
501 if (newinfo == NULL) 501 if (newinfo == NULL)
502 { 502 {
503 (*__morecore) (-size); 503 (*__morecore) (-(int)size);
504 return NULL; 504 return NULL;
505 } 505 }
506 memcpy (newinfo, _heapinfo, heapsize * sizeof (malloc_info)); 506 memcpy (newinfo, _heapinfo, heapsize * sizeof (malloc_info));
507 memset (&newinfo[heapsize], 0, 507 memset (&newinfo[heapsize], 0,
508 (newsize - heapsize) * sizeof (malloc_info)); 508 (newsize - heapsize) * sizeof (malloc_info));
840 if (blocks >= FINAL_FREE_BLOCKS && block + blocks == _heaplimit 840 if (blocks >= FINAL_FREE_BLOCKS && block + blocks == _heaplimit
841 && (*__morecore) (0) == ADDRESS (block + blocks)) 841 && (*__morecore) (0) == ADDRESS (block + blocks))
842 { 842 {
843 __malloc_size_t bytes = blocks * BLOCKSIZE; 843 __malloc_size_t bytes = blocks * BLOCKSIZE;
844 _heaplimit -= blocks; 844 _heaplimit -= blocks;
845 (*__morecore) (-bytes); 845 (*__morecore) (-(int)bytes);
846 _heapinfo[_heapinfo[block].free.prev].free.next 846 _heapinfo[_heapinfo[block].free.prev].free.next
847 = _heapinfo[block].free.next; 847 = _heapinfo[block].free.next;
848 _heapinfo[_heapinfo[block].free.next].free.prev 848 _heapinfo[_heapinfo[block].free.next].free.prev
849 = _heapinfo[block].free.prev; 849 = _heapinfo[block].free.prev;
850 block = _heapinfo[block].free.prev; 850 block = _heapinfo[block].free.prev;