diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-17 01:03:36 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-17 01:03:36 +0100 |
commit | b824aed3edf4f51b6a0fb13370c3abc75bc85206 (patch) | |
tree | 8feda621a9b1738f06780ce55d3462aada961e11 /Objective-C | |
parent | 61cf033c065e1de06524d29e246926985d0c06b6 (diff) |
Fix SLOT-VALUE-USING-CLASS (OBJECTIVE-C-CLASS ...).
darcs-hash:37402e60f79e9837371a68a33126e3b68eb32b09
Diffstat (limited to 'Objective-C')
-rw-r--r-- | Objective-C/libobjcl.h | 4 | ||||
-rw-r--r-- | Objective-C/libobjcl.m | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h index 4b26fae..758c831 100644 --- a/Objective-C/libobjcl.h +++ b/Objective-C/libobjcl.h @@ -139,8 +139,8 @@ objcl_alignof_type (const char *typespec); void objcl_set_slot_value (id obj, const char *ivar_name, void *value); -void * -objcl_slot_value (id obj, const char *ivar_name); +void +objcl_get_slot_value (id obj, const char *ivar_name, void *value_out); /* The following function returns a freshly consed array that the caller must deallocate. */ diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m index cd35b86..d02e58b 100644 --- a/Objective-C/libobjcl.m +++ b/Objective-C/libobjcl.m @@ -487,15 +487,19 @@ objcl_set_slot_value (id obj, const char *ivar_name, void *value) } -void * -objcl_slot_value (id obj, const char *ivar_name) +void +objcl_get_slot_value (id obj, const char *ivar_name, void *value_out) { - void *value; /* Caching Ivars may be useful here. Using those instead of strings is claimed to be faster. */ + /* For the GNU runtime, this function is defined in objc-runtime-gnu.m. */ - object_getInstanceVariable (obj, ivar_name, &value); - return value; + + /* NOTE: Contrary to what the official Objective-C runtime docs claim, + value_out is actually a (void *) rather than a (void **). + Likewise, the result that is copied to value_out is the slot value + itself, not a pointer to it. */ + object_getInstanceVariable (obj, ivar_name, value_out); } |