mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
In accordance with Objective C runtime change, use objc_realloc as a
function, not a function pointer. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1727 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ff62ff2d40
commit
50706f1be6
2 changed files with 13 additions and 11 deletions
|
@ -157,14 +157,14 @@ NSZone *NSCreateZone(size_t startSize, size_t granularity, int canFree)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("entered NSCreateZone\n");
|
printf("entered NSCreateZone\n");
|
||||||
#endif
|
#endif
|
||||||
ptr = (NSZone *) (*objc_malloc)(sizeof(NSZone));
|
ptr = (NSZone *) objc_malloc (sizeof(NSZone));
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("out of memory for zone structure\n");
|
printf("out of memory for zone structure\n");
|
||||||
#endif
|
#endif
|
||||||
return NS_NOZONE;
|
return NS_NOZONE;
|
||||||
}
|
}
|
||||||
ptr->base = (void *) (*objc_valloc)(startSize);
|
ptr->base = (void *) objc_valloc (startSize);
|
||||||
if (ptr->base == NULL) {
|
if (ptr->base == NULL) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("out of memory for zone\n");
|
printf("out of memory for zone\n");
|
||||||
|
@ -301,7 +301,8 @@ void *NSZoneMalloc(NSZone *zonep, size_t size)
|
||||||
chunkdesc temp,*chunk;
|
chunkdesc temp,*chunk;
|
||||||
NSZone *newzone;
|
NSZone *newzone;
|
||||||
|
|
||||||
if (zonep == NS_NOZONE) return (*objc_malloc) (size);
|
if (zonep == NS_NOZONE)
|
||||||
|
return objc_malloc (size);
|
||||||
/* round size up to the nearest word, so that all chunks are word aligned */
|
/* round size up to the nearest word, so that all chunks are word aligned */
|
||||||
oddsize = (size % WORDSIZE);
|
oddsize = (size % WORDSIZE);
|
||||||
newsize = size - oddsize + (oddsize?WORDSIZE:0);
|
newsize = size - oddsize + (oddsize?WORDSIZE:0);
|
||||||
|
@ -392,7 +393,8 @@ void *NSZoneRealloc(NSZone *zonep, void *ptr, size_t size)
|
||||||
void *ptr2;
|
void *ptr2;
|
||||||
chunkdesc temp,*chunk,*nextchunk,*priorchunk;
|
chunkdesc temp,*chunk,*nextchunk,*priorchunk;
|
||||||
|
|
||||||
if (zonep == NS_NOZONE) return (*objc_realloc)(ptr,size);
|
if (zonep == NS_NOZONE)
|
||||||
|
return objc_realloc (ptr,size);
|
||||||
|
|
||||||
if (zonep->canFree) {
|
if (zonep->canFree) {
|
||||||
i = searchheap(&(zonep->heap),ptr);
|
i = searchheap(&(zonep->heap),ptr);
|
||||||
|
@ -799,12 +801,12 @@ void *addtolist(void *ptr,llist *list, int at)
|
||||||
if (list->LList == NULL) {
|
if (list->LList == NULL) {
|
||||||
list->Size = DEFAULTLISTSIZE;
|
list->Size = DEFAULTLISTSIZE;
|
||||||
list->LList = (void *)
|
list->LList = (void *)
|
||||||
(*objc_malloc)(list->ElementSize * list->Size);
|
objc_malloc (list->ElementSize * list->Size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
list->Size *= 2;
|
list->Size *= 2;
|
||||||
list->LList = (void *)
|
list->LList = (void *)
|
||||||
(*objc_realloc)(list->LList, list->ElementSize * list->Size);
|
objc_realloc (list->LList, list->ElementSize * list->Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ static inline void _makeRoomForAnotherIfNecessary(Storage *self)
|
||||||
assert(self->maxElements);
|
assert(self->maxElements);
|
||||||
self->maxElements *= 2;
|
self->maxElements *= 2;
|
||||||
self->dataPtr = (void*)
|
self->dataPtr = (void*)
|
||||||
(*objc_realloc)(self->dataPtr, self->maxElements*self->elementSize);
|
objc_realloc (self->dataPtr, self->maxElements*self->elementSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ static inline void _shrinkIfDesired(Storage *self)
|
||||||
{
|
{
|
||||||
self->maxElements /= 2;
|
self->maxElements /= 2;
|
||||||
self->dataPtr = (void *)
|
self->dataPtr = (void *)
|
||||||
(*objc_realloc)(self->dataPtr, self->maxElements*self->elementSize);
|
objc_realloc (self->dataPtr, self->maxElements*self->elementSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ static inline void _shrinkIfDesired(Storage *self)
|
||||||
if (numSlots > numElements)
|
if (numSlots > numElements)
|
||||||
{
|
{
|
||||||
maxElements = numSlots;
|
maxElements = numSlots;
|
||||||
dataPtr = (void*) (*objc_realloc)(dataPtr, maxElements * elementSize);
|
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ static inline void _shrinkIfDesired(Storage *self)
|
||||||
if (numSlots > numElements)
|
if (numSlots > numElements)
|
||||||
{
|
{
|
||||||
maxElements = numSlots;
|
maxElements = numSlots;
|
||||||
dataPtr = (void*) (*objc_realloc)(dataPtr, maxElements * elementSize);
|
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||||
bzero(STORAGE_NTH(numElements), (maxElements-numElements)*elementSize);
|
bzero(STORAGE_NTH(numElements), (maxElements-numElements)*elementSize);
|
||||||
}
|
}
|
||||||
else if (numSlots < numElements)
|
else if (numSlots < numElements)
|
||||||
|
@ -256,7 +256,7 @@ static inline void _shrinkIfDesired(Storage *self)
|
||||||
{
|
{
|
||||||
numElements = 0;
|
numElements = 0;
|
||||||
maxElements = 1;
|
maxElements = 1;
|
||||||
dataPtr = (void*) (*objc_realloc)(dataPtr, maxElements * elementSize);
|
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue