From a2463192d0fd68940a276bb1108964f46be9d51e Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Thu, 16 May 2019 17:15:06 +0200 Subject: [PATCH] Use `id` as type for block runtime functions. Fixes #103. --- block_to_imp.c | 6 +++--- objc/runtime.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block_to_imp.c b/block_to_imp.c index 1dbb89c..97f05c5 100644 --- a/block_to_imp.c +++ b/block_to_imp.c @@ -181,7 +181,7 @@ static struct trampoline_set *alloc_trampolines(char *start, char *end) static struct trampoline_set *sret_trampolines; static struct trampoline_set *trampolines; -IMP imp_implementationWithBlock(void *block) +IMP imp_implementationWithBlock(id block) { struct Block_layout *b = block; void *start; @@ -250,7 +250,7 @@ static int indexForIMP(IMP anIMP, struct trampoline_set **setptr) return -1; } -void *imp_getBlock(IMP anImp) +id imp_getBlock(IMP anImp) { LOCK_FOR_SCOPE(&trampoline_lock); struct trampoline_set *set = trampolines; @@ -291,7 +291,7 @@ BOOL imp_removeBlock(IMP anImp) PRIVATE size_t lengthOfTypeEncoding(const char *types); -char *block_copyIMPTypeEncoding_np(void*block) +char *block_copyIMPTypeEncoding_np(id block) { char *buffer = strdup(block_getType_np(block)); if (NULL == buffer) { return NULL; } diff --git a/objc/runtime.h b/objc/runtime.h index 5dd8a75..d62114b 100644 --- a/objc/runtime.h +++ b/objc/runtime.h @@ -1077,7 +1077,7 @@ void objc_removeAssociatedObjects(id object); * arguments as the method. */ OBJC_PUBLIC -IMP imp_implementationWithBlock(void *block); +IMP imp_implementationWithBlock(id block); /** * Returns the type encoding of an IMP that would be returned by passing the * block to imp_implementationWithBlock(). Returns NULL if this is not a valid @@ -1085,14 +1085,14 @@ IMP imp_implementationWithBlock(void *block); * argument). The caller is responsible for freeing the returned value. */ OBJC_PUBLIC -char *block_copyIMPTypeEncoding_np(void*block); +char *block_copyIMPTypeEncoding_np(id block); /** * Returns the block that was used in an IMP created by * imp_implementationWithBlock(). The result of calling this function with any * other IMP is undefined. */ OBJC_PUBLIC -void *imp_getBlock(IMP anImp); +id imp_getBlock(IMP anImp); /** * Removes a block that was converted to an IMP with * imp_implementationWithBlock(). The result of calling this function with any