@@ -49,13 +49,13 @@ #endif #if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) OF_CONSTRUCTOR() { - OFEnsure(OFTLSKeyNew(&objectsKey) == 0); - OFEnsure(OFTLSKeyNew(&countKey) == 0); - OFEnsure(OFTLSKeyNew(&sizeKey) == 0); + if (OFTLSKeyNew(&objectsKey) != 0 || OFTLSKeyNew(&countKey) != 0 || + OFTLSKeyNew(&sizeKey) != 0) + OBJC_ERROR("Failed to create TLS keys!"); } #endif void * objc_autoreleasePoolPush() @@ -96,17 +96,19 @@ free(objects); objects = NULL; #if defined(OF_HAVE_COMPILER_TLS) || !defined(OF_HAVE_THREADS) size = 0; #else - OFEnsure(OFTLSKeySet(objectsKey, objects) == 0); - OFEnsure(OFTLSKeySet(sizeKey, (void *)0) == 0); + if (OFTLSKeySet(objectsKey, objects) != 0 || + OFTLSKeySet(sizeKey, (void *)0) != 0) + OBJC_ERROR("Failed to set TLS key!"); #endif } #if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - OFEnsure(OFTLSKeySet(countKey, (void *)count) == 0); + if (OFTLSKeySet(countKey, (void *)count) != 0) + OBJC_ERROR("Failed to set TLS key!"); #endif } id _objc_rootAutorelease(id object) @@ -121,22 +123,24 @@ if (size == 0) size = 16; else size *= 2; - OFEnsure((objects = - realloc(objects, size * sizeof(id))) != NULL); + if ((objects = realloc(objects, size * sizeof(id))) == NULL) + OBJC_ERROR("Failed to resize autorelease pool!"); #if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - OFEnsure(OFTLSKeySet(objectsKey, objects) == 0); - OFEnsure(OFTLSKeySet(sizeKey, (void *)size) == 0); + if (OFTLSKeySet(objectsKey, objects) != 0 || + OFTLSKeySet(sizeKey, (void *)size) != 0) + OBJC_ERROR("Failed to set TLS key!"); #endif } objects[count++] = object; #if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS) - OFEnsure(OFTLSKeySet(countKey, (void *)count) == 0); + if (OFTLSKeySet(countKey, (void *)count) != 0) + OBJC_ERROR("Failed to set TLS key!"); #endif return object; }