From 3db1a28cced42f050f27fb7669101ab2193d9027 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Wed, 15 Dec 2010 01:35:20 +0000 Subject: [PATCH] In libobjc/: 2010-12-15 Nicola Pero In libobjc/: 2010-12-15 Nicola Pero * ivars.c (class_addIvar): Use the 'size' argument instead of trying to calculate it using objc_sizeof_type(). * objc/runtime.h (class_addIvar): Updated comments. From-SVN: r167837 --- libobjc/ChangeLog | 6 ++++++ libobjc/ivars.c | 2 +- libobjc/objc/runtime.h | 9 ++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 7b3495a73ae..2a9de964d79 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,5 +1,11 @@ 2010-12-15 Nicola Pero + * ivars.c (class_addIvar): Use the 'size' argument instead of + trying to calculate it using objc_sizeof_type(). + * objc/runtime.h (class_addIvar): Updated comments. + +2010-12-15 Nicola Pero + * sendmsg.c: Reindented some code and tidied up comments. No actual code changes. diff --git a/libobjc/ivars.c b/libobjc/ivars.c index 69524bfd1dd..65de497fc89 100644 --- a/libobjc/ivars.c +++ b/libobjc/ivars.c @@ -296,7 +296,7 @@ class_addIvar (Class class_, const char * ivar_name, size_t size, else ivar->ivar_offset = class_->instance_size - misalignment + alignment; - class_->instance_size = ivar->ivar_offset + objc_sizeof_type (ivar->ivar_type); + class_->instance_size = ivar->ivar_offset + size; } return YES; diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h index f5df691fe52..94f5bf7f10a 100644 --- a/libobjc/objc/runtime.h +++ b/libobjc/objc/runtime.h @@ -319,11 +319,10 @@ objc_EXPORT Ivar * class_copyIvarList (Class class_, unsigned int *numberOfRetur instance variables to classes already registered with the runtime. 'size' is the size of the instance variable, 'alignment' the alignment, and 'type' the type encoding of the variable type. You - can use objc_sizeof_type() (or sizeof()), objc_alignof_type() (or - __alignof__()) and @encode() to determine the right 'size', - 'alignment' and 'type' for your instance variable. For example, to - add an instance variable name "my_variable" and of type 'id', you - can use: + can use sizeof(), __alignof__() and @encode() to determine the + right 'size', 'alignment' and 'type' for your instance variable. + For example, to add an instance variable name "my_variable" and of + type 'id', you can use: class_addIvar (class, "my_variable", sizeof (id), __alignof__ (id), @encode (id)); -- 2.11.4.GIT