mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Include <objects/stdobjects.h>
Use OBJC_MALLOC and friends, instead of NX_MALLOC. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1211 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
02282bc913
commit
822381a98f
1 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* Implementation of Objective-C NeXT-compatible List object
|
/* Implementation of Objective-C NeXT-compatible List object
|
||||||
Copyright (C) 1993,1994 Free Software Foundation, Inc.
|
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the GNU Objective C Class Library.
|
This file is part of the GNU Objective C Class Library.
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <objects/stdobjects.h>
|
||||||
#include <objc/List.h>
|
#include <objc/List.h>
|
||||||
|
|
||||||
/* Change this #define to 0 if you want -makeObjectsPerform: and
|
/* Change this #define to 0 if you want -makeObjectsPerform: and
|
||||||
|
@ -84,7 +85,7 @@ decrementCount(List *self)
|
||||||
[super init];
|
[super init];
|
||||||
numElements = 0;
|
numElements = 0;
|
||||||
maxElements = numSlots;
|
maxElements = numSlots;
|
||||||
NX_MALLOC(dataPtr, id, maxElements);
|
OBJC_MALLOC(dataPtr, id, maxElements);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ decrementCount(List *self)
|
||||||
- free
|
- free
|
||||||
{
|
{
|
||||||
if (dataPtr)
|
if (dataPtr)
|
||||||
NX_FREE(dataPtr);
|
OBJC_FREE(dataPtr);
|
||||||
return [super free];
|
return [super free];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ decrementCount(List *self)
|
||||||
- shallowCopy
|
- shallowCopy
|
||||||
{
|
{
|
||||||
List *c = [super shallowCopy];
|
List *c = [super shallowCopy];
|
||||||
NX_MALLOC(c->dataPtr, id, maxElements);
|
OBJC_MALLOC(c->dataPtr, id, maxElements);
|
||||||
memcpy(c->dataPtr, dataPtr, numElements * sizeof(id *));
|
memcpy(c->dataPtr, dataPtr, numElements * sizeof(id *));
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +163,7 @@ decrementCount(List *self)
|
||||||
if (numSlots > numElements)
|
if (numSlots > numElements)
|
||||||
{
|
{
|
||||||
maxElements = numSlots;
|
maxElements = numSlots;
|
||||||
NX_REALLOC(dataPtr, id, maxElements);
|
OBJC_REALLOC(dataPtr, id, maxElements);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -317,7 +318,7 @@ decrementCount(List *self)
|
||||||
{
|
{
|
||||||
[super read: aStream];
|
[super read: aStream];
|
||||||
objc_read_types (aStream, "II", &numElements, &maxElements);
|
objc_read_types (aStream, "II", &numElements, &maxElements);
|
||||||
NX_MALLOC(dataPtr, id, maxElements);
|
OBJC_MALLOC(dataPtr, id, maxElements);
|
||||||
objc_read_array (aStream, "@", numElements, dataPtr);
|
objc_read_array (aStream, "@", numElements, dataPtr);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue