Use __unsafe_unretained instead of const for returning protocol arrays. Let's not break everyone's code, even if we really want to.

main
theraven 15 years ago
parent b5380d50d3
commit 9b70b22eee

@ -231,7 +231,7 @@ objc_property_t* class_copyPropertyList(Class cls, unsigned int *outCount);
* outCount argument is set to the number of protocols returned. The caller is * outCount argument is set to the number of protocols returned. The caller is
* responsible for freeing the returned buffer. * responsible for freeing the returned buffer.
*/ */
Protocol *const* class_copyProtocolList(Class cls, unsigned int *outCount); Protocol *__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount);
/** /**
* Creates an instance of this class, allocating memory using malloc. * Creates an instance of this class, allocating memory using malloc.
@ -613,7 +613,7 @@ objc_property_t *protocol_copyPropertyList(Protocol *p, unsigned int *count);
* number of protocols in the array being returned via the last argument. The * number of protocols in the array being returned via the last argument. The
* caller is responsible for freeing this array. * caller is responsible for freeing this array.
*/ */
Protocol *const*protocol_copyProtocolList(Protocol *p, unsigned int *count); Protocol *__unsafe_unretained*protocol_copyProtocolList(Protocol *p, unsigned int *count);
/** /**
* Returns all of the protocols that the runtime is aware of. Note that * Returns all of the protocols that the runtime is aware of. Note that
@ -623,7 +623,7 @@ Protocol *const*protocol_copyProtocolList(Protocol *p, unsigned int *count);
* *
* The caller is responsible for freeing the returned array. * The caller is responsible for freeing the returned array.
*/ */
Protocol *const*objc_copyProtocolList(unsigned int *outCount); Protocol *__unsafe_unretained*objc_copyProtocolList(unsigned int *outCount);
/** /**
* Returns the method description for the specified method within a given * Returns the method description for the specified method within a given
* protocol. * protocol.

@ -329,7 +329,7 @@ struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p,
return out; return out;
} }
Protocol*const* protocol_copyProtocolList(Protocol *p, unsigned int *count) Protocol*__unsafe_unretained* protocol_copyProtocolList(Protocol *p, unsigned int *count)
{ {
if (NULL == p) { return NULL; } if (NULL == p) { return NULL; }
*count = 0; *count = 0;
@ -474,7 +474,7 @@ BOOL protocol_isEqual(Protocol *p, Protocol *other)
return NO; return NO;
} }
Protocol*const* objc_copyProtocolList(unsigned int *outCount) Protocol*__unsafe_unretained* objc_copyProtocolList(unsigned int *outCount)
{ {
unsigned int total = known_protocol_table->table_used; unsigned int total = known_protocol_table->table_used;
Protocol **p = calloc(sizeof(Protocol*), known_protocol_table->table_used); Protocol **p = calloc(sizeof(Protocol*), known_protocol_table->table_used);

@ -235,7 +235,7 @@ Method * class_copyMethodList(Class cls, unsigned int *outCount)
return list; return list;
} }
Protocol*const* class_copyProtocolList(Class cls, unsigned int *outCount) Protocol*__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount)
{ {
CHECK_ARG(cls); CHECK_ARG(cls);
struct objc_protocol_list *protocolList = NULL; struct objc_protocol_list *protocolList = NULL;

Loading…
Cancel
Save