Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -854,12 +854,11 @@ case OF_NUMBER_INT16: case OF_NUMBER_INT32: case OF_NUMBER_INT64: case OF_NUMBER_INTMAX: case OF_NUMBER_PTRDIFF: - return ([(OFNumber*)obj intMaxValue] == [self intMaxValue] - ? YES : NO); + return ([(OFNumber*)obj intMaxValue] == [self intMaxValue]); case OF_NUMBER_SSIZE: case OF_NUMBER_UCHAR: case OF_NUMBER_USHORT: case OF_NUMBER_UINT: case OF_NUMBER_ULONG: @@ -869,16 +868,14 @@ case OF_NUMBER_UINT64: case OF_NUMBER_SIZE: case OF_NUMBER_UINTMAX: case OF_NUMBER_INTPTR: case OF_NUMBER_UINTPTR: - return ([(OFNumber*)obj uIntMaxValue] == [self uIntMaxValue] - ? YES : NO); + return ([(OFNumber*)obj uIntMaxValue] == [self uIntMaxValue]); case OF_NUMBER_FLOAT: case OF_NUMBER_DOUBLE: - return ([(OFNumber*)obj doubleValue] == [self doubleValue] - ? YES : NO); + return ([(OFNumber*)obj doubleValue] == [self doubleValue]); default: return NO; } } Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -547,11 +547,11 @@ } - (BOOL)isEqual: (id)obj { /* Classes containing data should reimplement this! */ - return (self == obj ? YES : NO); + return (self == obj); } - (uint32_t)hash { /* Classes containing data should reimplement this! */ Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1070,22 +1070,21 @@ size_t len = [prefix cStringLength]; if (len > length) return NO; - return (memcmp(string, [prefix cString], len) ? NO : YES); + return !memcmp(string, [prefix cString], len); } - (BOOL)hasSuffix: (OFString*)suffix { size_t len = [suffix cStringLength]; if (len > length) return NO; - return (memcmp(string + (length - len), [suffix cString], len) - ? NO : YES); + return !memcmp(string + (length - len), [suffix cString], len); } - (OFArray*)componentsSeparatedByString: (OFString*)delimiter { OFAutoreleasePool *pool; Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -220,11 +220,11 @@ continue; if (buf[i] == '\r' || (buf[i] == '\n' && !lastCarriageReturn)) lineNumber++; - lastCarriageReturn = (buf[i] == '\r' ? YES : NO); + lastCarriageReturn = (buf[i] == '\r'); } /* In OF_XMLPARSER_IN_TAG, there can be only spaces */ if (size - last > 0 && state != OF_XMLPARSER_IN_TAG) [cache appendCStringWithoutUTF8Checking: buf + last Index: src/objc_sync.m ================================================================== --- src/objc_sync.m +++ src/objc_sync.m @@ -49,11 +49,11 @@ } BOOL objc_sync_init() { - return (of_mutex_new(&mutex) ? YES : NO); + return of_mutex_new(&mutex); } int objc_sync_enter(id obj) { Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -59,17 +59,17 @@ static OF_INLINE BOOL of_thread_new(of_thread_t *thread, id (*main)(id), id data) { #if defined(OF_HAVE_PTHREADS) - return (pthread_create(thread, NULL, (void*(*)(void*))main, - (void*)data) ? NO : YES); + return !pthread_create(thread, NULL, (void*(*)(void*))main, + (void*)data); #elif defined(_WIN32) *thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main, (void*)data, 0, NULL); - return (thread == NULL ? NO : YES); + return (thread != NULL); #endif } static OF_INLINE BOOL of_thread_join(of_thread_t thread) @@ -78,11 +78,11 @@ void *ret; if (pthread_join(thread, &ret)) return NO; - return (ret != PTHREAD_CANCELED ? YES : NO); + return (ret != PTHREAD_CANCELED); #elif defined(_WIN32) if (WaitForSingleObject(thread, INFINITE)) return NO; CloseHandle(thread); @@ -103,11 +103,11 @@ static OF_INLINE BOOL of_mutex_new(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) - return (pthread_mutex_init(mutex, NULL) ? NO : YES); + return !pthread_mutex_init(mutex, NULL); #elif defined(_WIN32) InitializeCriticalSection(mutex); return YES; #endif } @@ -114,11 +114,11 @@ static OF_INLINE BOOL of_mutex_free(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) - return (pthread_mutex_destroy(mutex) ? NO : YES); + return !pthread_mutex_destroy(mutex); #elif defined(_WIN32) DeleteCriticalSection(mutex); return YES; #endif } @@ -125,11 +125,11 @@ static OF_INLINE BOOL of_mutex_lock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) - return (pthread_mutex_lock(mutex) ? NO : YES); + return !pthread_mutex_lock(mutex); #elif defined(_WIN32) EnterCriticalSection(mutex); return YES; #endif } @@ -136,21 +136,21 @@ static OF_INLINE BOOL of_mutex_trylock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) - return (pthread_mutex_trylock(mutex) ? NO : YES); + return !pthread_mutex_trylock(mutex); #elif defined(_WIN32) - return (TryEnterCriticalSection(mutex) ? YES : NO); + return TryEnterCriticalSection(mutex); #endif } static OF_INLINE BOOL of_mutex_unlock(of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) - return (pthread_mutex_unlock(mutex) ? NO : YES); + return !pthread_mutex_unlock(mutex); #elif defined(_WIN32) LeaveCriticalSection(mutex); return YES; #endif } @@ -157,11 +157,11 @@ static OF_INLINE BOOL of_condition_new(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) - return (pthread_cond_init(condition, NULL) ? NO : YES); + return !pthread_cond_init(condition, NULL); #elif defined(_WIN32) condition->count = 0; if ((condition->event = CreateEvent(NULL, FALSE, 0, NULL)) == NULL) return NO; @@ -168,15 +168,19 @@ return YES; #endif } +#if defined(OF_HAVE_PTHREADS) static OF_INLINE BOOL +#elif defined(_WIN32) +static BOOL +#endif of_condition_wait(of_condition_t *condition, of_mutex_t *mutex) { #if defined(OF_HAVE_PTHREADS) - return (pthread_cond_wait(condition, mutex) ? NO : YES); + return !pthread_cond_wait(condition, mutex); #elif defined(_WIN32) if (!of_mutex_unlock(mutex)) return NO; of_atomic_inc_int(&condition->count); @@ -197,21 +201,25 @@ static OF_INLINE BOOL of_condition_signal(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) - return (pthread_cond_signal(condition) ? NO : YES); + return !pthread_cond_signal(condition); #elif defined(_WIN32) - return (SetEvent(condition->event) ? YES : NO); + return SetEvent(condition->event); #endif } +#if defined(OF_HAVE_PTHREADS) static OF_INLINE BOOL +#elif defined(_WIN32) +static BOOL +#endif of_condition_broadcast(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) - return (pthread_cond_broadcast(condition) ? NO : YES); + return !pthread_cond_broadcast(condition); #elif defined(_WIN32) size_t i; for (i = 0; i < condition->count; i++) if (!SetEvent(condition->event)) @@ -219,30 +227,34 @@ return YES; #endif } +#if defined(OF_HAVE_PTHREADS) static OF_INLINE BOOL +#elif defined(_WIN32) +static BOOL +#endif of_condition_free(of_condition_t *condition) { #if defined(OF_HAVE_PTHREADS) - return (pthread_cond_destroy(condition) ? NO : YES); + return !pthread_cond_destroy(condition); #elif defined(_WIN32) if (condition->count) return NO; - return (CloseHandle(condition->event) ? YES : NO); + return CloseHandle(condition->event); #endif } static OF_INLINE BOOL of_tlskey_new(of_tlskey_t *key) { #if defined(OF_HAVE_PTHREADS) - return (pthread_key_create(key, NULL) ? NO : YES); + return !pthread_key_create(key, NULL); #elif defined(_WIN32) - return ((*key = TlsAlloc()) == TLS_OUT_OF_INDEXES ? NO : YES); + return ((*key = TlsAlloc()) != TLS_OUT_OF_INDEXES); #endif } static OF_INLINE id of_tlskey_get(of_tlskey_t key) @@ -264,23 +276,23 @@ of_tlskey_set(of_tlskey_t key, id obj) { void *p = (obj != nil ? (void*)obj : NULL); #if defined(OF_HAVE_PTHREADS) - return (pthread_setspecific(key, p) ? NO : YES); + return !pthread_setspecific(key, p); #elif defined(_WIN32) - return (TlsSetValue(key, p) ? YES : NO); + return TlsSetValue(key, p); #endif } static OF_INLINE BOOL of_tlskey_free(of_tlskey_t key) { #if defined(OF_HAVE_PTHREADS) - return (pthread_key_delete(key) ? NO : YES); + return !pthread_key_delete(key); #elif defined(_WIN32) - return (TlsFree(key) ? YES : NO); + return TlsFree(key); #endif } static OF_INLINE BOOL of_spinlock_new(of_spinlock_t *s) @@ -287,23 +299,23 @@ { #if defined(OF_ATOMIC_OPS) *s = 0; return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) - return (pthread_spin_init(s, 0) ? NO : YES); + return !pthread_spin_init(s, 0); #else return of_mutex_new(s); #endif } static OF_INLINE BOOL of_spinlock_trylock(of_spinlock_t *s) { #if defined(OF_ATOMIC_OPS) - return (of_atomic_cmpswap_int(s, 0, 1) ? YES : NO); + return of_atomic_cmpswap_int(s, 0, 1); #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) - return (pthread_spin_trylock(s) ? NO : YES); + return !pthread_spin_trylock(s); #else return of_mutex_trylock(s); #endif } @@ -328,11 +340,11 @@ while (!of_spinlock_trylock(s)); # endif return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) - return (pthread_spin_lock(s) ? NO : YES); + return !pthread_spin_lock(s); #else return of_mutex_lock(s); #endif } @@ -341,11 +353,11 @@ { #if defined(OF_ATOMIC_OPS) *s = 0; return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) - return (pthread_spin_unlock(s) ? NO : YES); + return !pthread_spin_unlock(s); #else return of_mutex_unlock(s); #endif } @@ -353,10 +365,10 @@ of_spinlock_free(of_spinlock_t *s) { #if defined(OF_ATOMIC_OPS) return YES; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) - return (pthread_spin_destroy(s) ? NO : YES); + return !pthread_spin_destroy(s); #else return of_mutex_free(s); #endif }