<http://www.gnu.org/licenses/>. */
#include "objc-private/common.h"
-#include "objc/objc.h"
#include "objc/runtime.h"
#include "objc-private/module-abi-8.h" /* For runtime structures */
#include "objc/thr.h"
#include "objc-private/runtime.h" /* the kitchen sink */
#include "objc-private/hash.h" /* For the hash table of protocols. */
-#include "objc-private/protocols.h" /* For __objc_protocols_init() and __objc_protocols_add_protocol() */
+#include "objc-private/protocols.h" /* For __objc_protocols_init() and
+ __objc_protocols_add_protocol(). */
+#include <stdlib.h> /* For malloc. */
/* This is a table that maps a name to a Protocol instance with that
name. Because there may be multiple Protocol instances with the
Objective-C programs while trying to catch a problem that has
never been seen in practice, so we don't do it. */
if (! objc_hash_is_key_in_hash (__protocols_hashtable, name))
- {
- objc_hash_add (&__protocols_hashtable, name, object);
- }
+ objc_hash_add (&__protocols_hashtable, name, object);
objc_mutex_unlock (__protocols_hashtable_lock);
}
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return NO;
objc_mutex_lock (__objc_runtime_mutex);
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return NO;
/* Acquire the runtime lock because the list of protocols for a
Protocol **returnValue = NULL;
struct objc_protocol_list* proto_list;
+ if (class_ == Nil)
+ {
+ if (numberOfReturnedProtocols)
+ *numberOfReturnedProtocols = 0;
+ return NULL;
+ }
+
/* Lock the runtime mutex because the class protocols may be
concurrently modified. */
objc_mutex_lock (__objc_runtime_mutex);
if (protocol->class_pointer != anotherProtocol->class_pointer)
return NO;
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return NO;
if (strcmp (((struct objc_protocol *)protocol)->protocol_name,
if (protocol->class_pointer != anotherProtocol->class_pointer)
return NO;
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return NO;
/* Equality between formal protocols is only formal (nothing to do
{
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return NULL;
return ((struct objc_protocol *)protocol)->protocol_name;
BOOL instanceMethod)
{
struct objc_method_description no_result = { NULL, NULL };
- const char* selector_name;
struct objc_method_description_list *methods;
int i;
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return no_result;
- selector_name = sel_getName (selector);
-
if (instanceMethod)
methods = ((struct objc_protocol *)protocol)->instance_methods;
else
{
for (i = 0; i < methods->count; i++)
{
- if (strcmp ((char*)(methods->list[i].name), selector_name) == 0)
+ if (sel_isEqual (methods->list[i].name, selector))
+ return methods->list[i];
+ /*
+ if (strcmp (sel_getName (methods->list[i].name), selector_name) == 0)
return methods->list[i];
+ */
}
}
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol == NULL || protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol == NULL || protocol->class_pointer != objc_lookUpClass ("Protocol"))
{
if (numberOfReturnedMethods)
*numberOfReturnedMethods = 0;
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol->class_pointer != objc_lookUpClass ("Protocol"))
return NULL;
/* TODO: New ABI. */
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol == NULL || protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol == NULL || protocol->class_pointer != objc_lookUpClass ("Protocol"))
{
if (numberOfReturnedProperties)
*numberOfReturnedProperties = 0;
/* Check that it is a Protocol object before casting it to (struct
objc_protocol *). */
- if (protocol == NULL || protocol->class_pointer != objc_lookupClass ("Protocol"))
+ if (protocol == NULL || protocol->class_pointer != objc_lookUpClass ("Protocol"))
{
if (numberOfReturnedProtocols)
*numberOfReturnedProtocols = 0;