mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
55e7a29194
commit
3cc0c23f3b
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
|
||||
printf("entered NSCreateZone\n");
|
||||
#endif
|
||||
ptr = (NSZone *) (*objc_malloc)(sizeof(NSZone));
|
||||
ptr = (NSZone *) objc_malloc (sizeof(NSZone));
|
||||
if (ptr == NULL) {
|
||||
#ifdef DEBUG
|
||||
printf("out of memory for zone structure\n");
|
||||
#endif
|
||||
return NS_NOZONE;
|
||||
}
|
||||
ptr->base = (void *) (*objc_valloc)(startSize);
|
||||
ptr->base = (void *) objc_valloc (startSize);
|
||||
if (ptr->base == NULL) {
|
||||
#ifdef DEBUG
|
||||
printf("out of memory for zone\n");
|
||||
|
@ -301,7 +301,8 @@ void *NSZoneMalloc(NSZone *zonep, size_t size)
|
|||
chunkdesc temp,*chunk;
|
||||
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 */
|
||||
oddsize = (size % WORDSIZE);
|
||||
newsize = size - oddsize + (oddsize?WORDSIZE:0);
|
||||
|
@ -392,7 +393,8 @@ void *NSZoneRealloc(NSZone *zonep, void *ptr, size_t size)
|
|||
void *ptr2;
|
||||
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) {
|
||||
i = searchheap(&(zonep->heap),ptr);
|
||||
|
@ -799,12 +801,12 @@ void *addtolist(void *ptr,llist *list, int at)
|
|||
if (list->LList == NULL) {
|
||||
list->Size = DEFAULTLISTSIZE;
|
||||
list->LList = (void *)
|
||||
(*objc_malloc)(list->ElementSize * list->Size);
|
||||
objc_malloc (list->ElementSize * list->Size);
|
||||
}
|
||||
else {
|
||||
list->Size *= 2;
|
||||
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);
|
||||
self->maxElements *= 2;
|
||||
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->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)
|
||||
{
|
||||
maxElements = numSlots;
|
||||
dataPtr = (void*) (*objc_realloc)(dataPtr, maxElements * elementSize);
|
||||
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ static inline void _shrinkIfDesired(Storage *self)
|
|||
if (numSlots > numElements)
|
||||
{
|
||||
maxElements = numSlots;
|
||||
dataPtr = (void*) (*objc_realloc)(dataPtr, maxElements * elementSize);
|
||||
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||
bzero(STORAGE_NTH(numElements), (maxElements-numElements)*elementSize);
|
||||
}
|
||||
else if (numSlots < numElements)
|
||||
|
@ -256,7 +256,7 @@ static inline void _shrinkIfDesired(Storage *self)
|
|||
{
|
||||
numElements = 0;
|
||||
maxElements = 1;
|
||||
dataPtr = (void*) (*objc_realloc)(dataPtr, maxElements * elementSize);
|
||||
dataPtr = (void*) objc_realloc (dataPtr, maxElements * elementSize);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue