From b824aed3edf4f51b6a0fb13370c3abc75bc85206 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 17 Feb 2008 01:03:36 +0100 Subject: Fix SLOT-VALUE-USING-CLASS (OBJECTIVE-C-CLASS ...). darcs-hash:37402e60f79e9837371a68a33126e3b68eb32b09 --- Objective-C/libobjcl.h | 4 ++-- Objective-C/libobjcl.m | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'Objective-C') 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); } -- cgit v1.2.3