@@ -35,11 +35,11 @@ static of_mutex_t mutex; OF_CONSTRUCTOR() { - if (!of_mutex_new(&mutex)) + if (of_mutex_new(&mutex) != 0) OBJC_ERROR("Failed to create mutex!"); } #endif int @@ -49,46 +49,46 @@ return 0; #ifdef OF_HAVE_THREADS struct lock_s *lock; - if (!of_mutex_lock(&mutex)) + if (of_mutex_lock(&mutex) != 0) OBJC_ERROR("Failed to lock mutex!"); /* Look if we already have a lock */ for (lock = locks; lock != NULL; lock = lock->next) { if (lock->object != object) continue; lock->count++; - if (!of_mutex_unlock(&mutex)) + if (of_mutex_unlock(&mutex) != 0) OBJC_ERROR("Failed to unlock mutex!"); - if (!of_rmutex_lock(&lock->rmutex)) + if (of_rmutex_lock(&lock->rmutex) != 0) OBJC_ERROR("Failed to lock mutex!"); return 0; } /* Create a new lock */ if ((lock = malloc(sizeof(*lock))) == NULL) OBJC_ERROR("Failed to allocate memory for mutex!"); - if (!of_rmutex_new(&lock->rmutex)) + if (of_rmutex_new(&lock->rmutex) != 0) OBJC_ERROR("Failed to create mutex!"); lock->object = object; lock->count = 1; lock->next = locks; locks = lock; - if (!of_mutex_unlock(&mutex)) + if (of_mutex_unlock(&mutex) != 0) OBJC_ERROR("Failed to unlock mutex!"); - if (!of_rmutex_lock(&lock->rmutex)) + if (of_rmutex_lock(&lock->rmutex) != 0) OBJC_ERROR("Failed to lock mutex!"); #endif return 0; } @@ -100,24 +100,24 @@ return 0; #ifdef OF_HAVE_THREADS struct lock_s *lock, *last = NULL; - if (!of_mutex_lock(&mutex)) + if (of_mutex_lock(&mutex) != 0) OBJC_ERROR("Failed to lock mutex!"); for (lock = locks; lock != NULL; lock = lock->next) { if (lock->object != object) { last = lock; continue; } - if (!of_rmutex_unlock(&lock->rmutex)) + if (of_rmutex_unlock(&lock->rmutex) != 0) OBJC_ERROR("Failed to unlock mutex!"); if (--lock->count == 0) { - if (!of_rmutex_free(&lock->rmutex)) + if (of_rmutex_free(&lock->rmutex) != 0) OBJC_ERROR("Failed to destroy mutex!"); if (last != NULL) last->next = lock->next; if (locks == lock) @@ -124,11 +124,11 @@ locks = lock->next; free(lock); } - if (!of_mutex_unlock(&mutex)) + if (of_mutex_unlock(&mutex) != 0) OBJC_ERROR("Failed to unlock mutex!"); return 0; }