#include <stdlib.h>
#include <string.h>
#include <stdint.h>
+#if HAVE_OBJC
#define __USE_GNU
#include <dlfcn.h>
+#endif
#if __has_include(<os/assumes.h>)
#include <os/assumes.h>
#else
Globals
************************/
+#if HAVE_OBJC
static void *_Block_copy_class = _NSConcreteMallocBlock;
static void *_Block_copy_finalizing_class = _NSConcreteMallocBlock;
static int _Block_copy_flag = BLOCK_NEEDS_FREE;
+#endif
static int _Byref_flag_initial_value = BLOCK_BYREF_NEEDS_FREE | 4; // logical 2
static bool isGC = false;
static void *_Block_alloc_default(const unsigned long size, const bool initialCountIsOne, const bool isObject) {
+ (void)initialCountIsOne;
+ (void)isObject;
return malloc(size);
}
}
static void _Block_setHasRefcount_default(const void *ptr, const bool hasRefcount) {
+ (void)ptr;
+ (void)hasRefcount;
}
+#if HAVE_OBJC
static void _Block_do_nothing(const void *aBlock) { }
+#endif
static void _Block_retain_object_default(const void *ptr) {
+ (void)ptr;
}
static void _Block_release_object_default(const void *ptr) {
+ (void)ptr;
}
static void _Block_assign_weak_default(const void *ptr, void *dest) {
memmove(dst, src, (size_t)size);
}
+#if HAVE_OBJC
static void _Block_memmove_gc_broken(void *dest, void *src, unsigned long size) {
void **destp = (void **)dest;
void **srcp = (void **)src;
size -= sizeof(void *);
}
}
+#endif
-static void _Block_destructInstance_default(const void *aBlock) {}
+static void _Block_destructInstance_default(const void *aBlock) {
+ (void)aBlock;
+}
/**************************************************************************
GC support callout functions - initially set to stub routines
static void (*_Block_destructInstance) (const void *aBlock) = _Block_destructInstance_default;
+#if HAVE_OBJC
/**************************************************************************
GC support SPI functions - called from ObjC runtime and CoreFoundation
***************************************************************************/
_Block_release_object = release;
_Block_destructInstance = dlsym(RTLD_DEFAULT, "objc_destructInstance");
}
+#endif // HAVE_OBJC
// Called from CF to indicate MRR. Newer version uses a versioned structure, so we can add more functions
// without defining a new entry point.