mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Moved an allocation size roundup operation in realloc().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15082 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -13,6 +13,8 @@
|
||||
- The printf() family stripped trailing zeroes from the integer part
|
||||
of %g output. Fixed.
|
||||
|
||||
- Moved an allocation size roundup operation in realloc().
|
||||
|
||||
|
||||
c.lib 1.198 (11.12.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_realloc.c,v 1.9 2006-01-08 12:04:26 obarthel Exp $
|
||||
* $Id: stdlib_realloc.c,v 1.10 2006-02-17 10:55:03 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -122,21 +122,21 @@ __realloc(void *ptr,size_t size,const char * file,int line)
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(size > mn->mn_Size)
|
||||
size_t rounded_allocation_size;
|
||||
|
||||
/* Round the total allocation size to the operating system
|
||||
granularity. */
|
||||
rounded_allocation_size = __get_allocation_size(size);
|
||||
|
||||
assert( rounded_allocation_size >= size );
|
||||
|
||||
if(rounded_allocation_size > mn->mn_Size)
|
||||
{
|
||||
/* Allocation size should grow. */
|
||||
reallocate = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t rounded_allocation_size;
|
||||
|
||||
/* Round the total allocation size to the operating system
|
||||
granularity. */
|
||||
rounded_allocation_size = __get_allocation_size(size);
|
||||
|
||||
assert( rounded_allocation_size >= size );
|
||||
|
||||
/* Optimization: If the block size shrinks by less than half the
|
||||
original allocation size, do not reallocate the
|
||||
block and do not copy over the contents of the old
|
||||
|
||||
Reference in New Issue
Block a user