mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
(NSAllocateObject, NSDeallocateObject, NSCopyObject): These functions
moved to separate files. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@154 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4d01c6b454
commit
6f6a4c1fcf
1 changed files with 0 additions and 30 deletions
|
@ -37,36 +37,6 @@
|
|||
extern void (*_objc_error)(id object, const char *format, va_list);
|
||||
extern int errno;
|
||||
|
||||
NSObject *NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone)
|
||||
{
|
||||
id new = nil;
|
||||
int size = aClass->instance_size + extraBytes;
|
||||
if (CLS_ISCLASS(aClass))
|
||||
new = (*objc_malloc) (size);
|
||||
if (new != nil)
|
||||
{
|
||||
memset (new, 0, size);
|
||||
new->class_pointer = aClass;
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
void NSDeallocateObject(NSObject *anObject)
|
||||
{
|
||||
if ((anObject!=nil) && CLS_ISCLASS(((id)anObject)->class_pointer))
|
||||
(*objc_free) (anObject);
|
||||
return;
|
||||
}
|
||||
|
||||
NSObject *NSCopyObject(NSObject *anObject, unsigned extraBytes, NSZone *zone)
|
||||
{
|
||||
id copy = NSAllocateObject(((id)anObject)->class_pointer, extraBytes, zone);
|
||||
memcpy(copy, anObject,
|
||||
((id)anObject)->class_pointer->instance_size + extraBytes);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
/* Reference count management */
|
||||
|
||||
/* Doesn't handle multi-threaded stuff.
|
||||
|
|
Loading…
Reference in a new issue