diff options
author | shebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-07-02 19:43:03 +0000 |
---|---|---|
committer | shebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-07-02 19:43:03 +0000 |
commit | 617763557711795ccc8087e4c7af30832f1af171 (patch) | |
tree | 8f207ea088d819aa3e3ed4230231f34c706b6e54 /libobjc/objects.c | |
parent | 894a031dc687848ac0c10c9e00a201f870b3179a (diff) | |
download | gcc-617763557711795ccc8087e4c7af30832f1af171.tar.gz |
2002-07-02 Rodney Brown <rbrown64@csc.com.au>
* objc/encoding.h: Fix formatting.
* objc/hash.h: Likewise.
* objc/objc-api.h: Likewise.
* objc/runtime.h: Likewise.
* objc/thr.h: Likewise.
* archive.c: Likewise.
* class.c: Likewise.
* encoding.c: Likewise.
* gc.c: Likewise.
* hash.c: Likewise.
* init.c: Likewise.
* misc.c: Likewise.
* nil_method.c: Likewise.
* objects.c: Likewise.
* sarray.c: Likewise.
* selector.c: Likewise.
* sendmsg.c: Likewise.
* thr-mach.c: Likewise.
* thr.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55190 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc/objects.c')
-rw-r--r-- | libobjc/objects.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/libobjc/objects.c b/libobjc/objects.c index df74b85de87..6858fed2013 100644 --- a/libobjc/objects.c +++ b/libobjc/objects.c @@ -32,29 +32,29 @@ Boston, MA 02111-1307, USA. */ # include <gc.h> #endif -id __objc_object_alloc(Class); -id __objc_object_dispose(id); -id __objc_object_copy(id); +id __objc_object_alloc (Class); +id __objc_object_dispose (id); +id __objc_object_copy (id); -id (*_objc_object_alloc)(Class) = __objc_object_alloc; /* !T:SINGLE */ -id (*_objc_object_dispose)(id) = __objc_object_dispose; /* !T:SINGLE */ -id (*_objc_object_copy)(id) = __objc_object_copy; /* !T:SINGLE */ +id (*_objc_object_alloc) (Class) = __objc_object_alloc; /* !T:SINGLE */ +id (*_objc_object_dispose) (id) = __objc_object_dispose; /* !T:SINGLE */ +id (*_objc_object_copy) (id) = __objc_object_copy; /* !T:SINGLE */ id -class_create_instance(Class class) +class_create_instance (Class class) { id new = nil; #if OBJC_WITH_GC - if (CLS_ISCLASS(class)) - new = (id)GC_malloc_explicitly_typed (class->instance_size, - class->gc_object_type); + if (CLS_ISCLASS (class)) + new = (id) GC_malloc_explicitly_typed (class->instance_size, + class->gc_object_type); #else - if (CLS_ISCLASS(class)) - new = (*_objc_object_alloc)(class); + if (CLS_ISCLASS (class)) + new = (*_objc_object_alloc) (class); #endif - if (new!=nil) + if (new != nil) { memset (new, 0, class->instance_size); new->class_pointer = class; @@ -63,43 +63,41 @@ class_create_instance(Class class) } id -object_copy(id object) +object_copy (id object) { - if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) - return (*_objc_object_copy)(object); + if ((object != nil) && CLS_ISCLASS (object->class_pointer)) + return (*_objc_object_copy) (object); else return nil; } id -object_dispose(id object) +object_dispose (id object) { - if ((object!=nil)&&CLS_ISCLASS(object->class_pointer)) + if ((object != nil) && CLS_ISCLASS (object->class_pointer)) { if (_objc_object_dispose) - (*_objc_object_dispose)(object); + (*_objc_object_dispose) (object); else - objc_free(object); + objc_free (object); } return nil; } -id __objc_object_alloc(Class class) +id __objc_object_alloc (Class class) { - return (id)objc_malloc(class->instance_size); + return (id) objc_malloc (class->instance_size); } -id __objc_object_dispose(id object) +id __objc_object_dispose (id object) { - objc_free(object); + objc_free (object); return 0; } -id __objc_object_copy(id object) +id __objc_object_copy (id object) { - id copy = class_create_instance(object->class_pointer); - memcpy(copy, object, object->class_pointer->instance_size); + id copy = class_create_instance (object->class_pointer); + memcpy (copy, object, object->class_pointer->instance_size); return copy; } - - |