@@ -19,21 +19,21 @@ #import "ObjFWRT.h" #import "private.h" #ifdef OF_HAVE_THREADS -# import "mutex.h" +# import "OFPlainMutex.h" # define NUM_SPINLOCKS 8 /* needs to be a power of 2 */ # define SPINLOCK_HASH(p) ((unsigned)((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)) -static of_spinlock_t spinlocks[NUM_SPINLOCKS]; +static OFSpinlock spinlocks[NUM_SPINLOCKS]; #endif #ifdef OF_HAVE_THREADS OF_CONSTRUCTOR() { for (size_t i = 0; i < NUM_SPINLOCKS; i++) - if (of_spinlock_new(&spinlocks[i]) != 0) + if (OFSpinlockNew(&spinlocks[i]) != 0) OBJC_ERROR("Failed to initialize spinlocks!"); } #endif id @@ -42,15 +42,15 @@ if (atomic) { id *ptr = (id *)(void *)((char *)self + offset); #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(ptr); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockLock(&spinlocks[hash]) == 0); @try { return [[*ptr retain] autorelease]; } @finally { - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockUnlock(&spinlocks[hash]) == 0); } #else return [[*ptr retain] autorelease]; #endif } @@ -65,11 +65,11 @@ if (atomic) { id *ptr = (id *)(void *)((char *)self + offset); #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(ptr); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockLock(&spinlocks[hash]) == 0); @try { #endif id old = *ptr; switch (copy) { @@ -84,11 +84,11 @@ } [old release]; #ifdef OF_HAVE_THREADS } @finally { - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockUnlock(&spinlocks[hash]) == 0); } #endif return; } @@ -117,15 +117,15 @@ { if (atomic) { #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(src); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockLock(&spinlocks[hash]) == 0); #endif memcpy(dest, src, size); #ifdef OF_HAVE_THREADS - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockUnlock(&spinlocks[hash]) == 0); #endif return; } @@ -138,15 +138,15 @@ { if (atomic) { #ifdef OF_HAVE_THREADS unsigned hash = SPINLOCK_HASH(src); - OF_ENSURE(of_spinlock_lock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockLock(&spinlocks[hash]) == 0); #endif memcpy(dest, src, size); #ifdef OF_HAVE_THREADS - OF_ENSURE(of_spinlock_unlock(&spinlocks[hash]) == 0); + OFEnsure(OFSpinlockUnlock(&spinlocks[hash]) == 0); #endif return; } @@ -189,11 +189,11 @@ i = 0; for (iter = class->propertyList; iter != NULL; iter = iter->next) for (unsigned int j = 0; j < iter->count; j++) properties[i++] = &iter->properties[j]; - OF_ENSURE(i == count); + OFEnsure(i == count); properties[count] = NULL; if (outCount != NULL) *outCount = count; @@ -217,22 +217,22 @@ if (strlen(name) != 1) return NULL; switch (*name) { case 'T': - ret = of_strdup(property->getter.typeEncoding); + ret = objc_strdup(property->getter.typeEncoding); nullIsError = true; break; case 'G': if (property->attributes & OBJC_PROPERTY_GETTER) { - ret = of_strdup(property->getter.name); + ret = objc_strdup(property->getter.name); nullIsError = true; } break; case 'S': if (property->attributes & OBJC_PROPERTY_SETTER) { - ret = of_strdup(property->setter.name); + ret = objc_strdup(property->setter.name); nullIsError = true; } break; #define BOOL_CASE(name, field, flag) \ case name: \