From 8979f19f1d812e2fa453fff98bf617d0de70eb1b Mon Sep 17 00:00:00 2001 From: theraven Date: Wed, 17 Jul 2013 14:03:59 +0000 Subject: [PATCH] Fix some bugs in protocol property introspection and remove a redundant #define. Reported by Krystof Vasa! --- arc.m | 1 - protocol.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arc.m b/arc.m index 1a81164..86d0982 100644 --- a/arc.m +++ b/arc.m @@ -488,7 +488,6 @@ const static WeakRef NullWeakRef; #define MAP_TABLE_COMPARE_FUNCTION weak_ref_compare #define MAP_TABLE_HASH_KEY ptr_hash #define MAP_TABLE_HASH_VALUE weak_ref_hash -#define MAP_TABLE_HASH_VALUE weak_ref_hash #define MAP_TABLE_VALUE_TYPE struct objc_weak_ref #define MAP_TABLE_VALUE_NULL weak_ref_is_null #define MAP_TABLE_VALUE_PLACEHOLDER NullWeakRef diff --git a/protocol.c b/protocol.c index 63e5c92..5b9e42e 100644 --- a/protocol.c +++ b/protocol.c @@ -361,7 +361,7 @@ objc_property_t *protocol_copyPropertyList(Protocol *protocol, } if (NULL != p->optional_properties) { - count = p->optional_properties->count; + count += p->optional_properties->count; } if (0 == count) { @@ -373,7 +373,7 @@ objc_property_t *protocol_copyPropertyList(Protocol *protocol, { for (int i=0 ; icount ; i++) { - list[out] = &properties->properties[i]; + list[out++] = &properties->properties[i]; } } properties = p->optional_properties; @@ -381,7 +381,7 @@ objc_property_t *protocol_copyPropertyList(Protocol *protocol, { for (int i=0 ; icount ; i++) { - list[out] = &properties->properties[i]; + list[out++] = &properties->properties[i]; } } *outCount = count;