diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-03-28 02:03:11 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-03-28 02:03:11 +0200 |
commit | 8657c93f0adeefd1b50d54ae30aa0a4ba2d89827 (patch) | |
tree | 4fde4d311d435ab0f5413e168f4c99767f7032ef | |
parent | ed3150fb7413fce0321ad88a22de7871a301f7c3 (diff) |
Fix coding style
-rw-r--r-- | forward.c | 10 | ||||
-rw-r--r-- | pthread/pt-exit.c | 2 | ||||
-rw-r--r-- | pthread/pt-join.c | 2 | ||||
-rw-r--r-- | pthread/pt-self.c | 2 | ||||
-rw-r--r-- | pthread/pt-setcancelstate.c | 2 | ||||
-rw-r--r-- | pthread/pt-setcanceltype.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/pt-cond-signal.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/pt-cond-timedwait.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/pt-destroy-specific.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/pt-mutex-timedlock.c | 14 | ||||
-rw-r--r-- | sysdeps/generic/pt-mutex-transfer-np.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/pt-mutex-trylock.c | 10 | ||||
-rw-r--r-- | sysdeps/generic/pt-rwlock-timedrdlock.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/pt-rwlock-timedwrlock.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/raise.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/sem-timedwait.c | 4 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/pt-setup.c | 2 | ||||
-rw-r--r-- | sysdeps/mach/hurd/pt-hurd-cond-timedwait.c | 6 | ||||
-rw-r--r-- | sysdeps/mach/hurd/pt-sigstate.c | 4 | ||||
-rw-r--r-- | sysdeps/mach/hurd/pt-sysdep.c | 4 |
20 files changed, 43 insertions, 43 deletions
@@ -194,7 +194,7 @@ atfork_pthread_parent (void) handlers = fork_handlers; __libc_lock_unlock (atfork_lock); - while (handlers) + while (handlers != NULL) { if (handlers->parent != NULL) handlers->parent (); @@ -212,7 +212,7 @@ atfork_pthread_child (void) handlers = fork_handlers; __libc_lock_unlock (atfork_lock); - while (handlers) + while (handlers != NULL) { if (handlers->child != NULL) handlers->child (); @@ -239,7 +239,7 @@ __register_atfork (void (*prepare) (void), __libc_lock_lock (atfork_lock); new->next = fork_handlers; - if (fork_handlers) + if (fork_handlers != NULL) fork_handlers->prev = new; fork_handlers = new; if (fork_last_handler == NULL) @@ -256,7 +256,7 @@ __unregister_atfork (void *dso_handle) struct atfork **handlers, *prev = NULL, *next; __libc_lock_lock (atfork_lock); handlers = &fork_handlers; - while (*handlers) + while (*handlers != NULL) { if ((*handlers)->dso_handle == dso_handle) { @@ -268,7 +268,7 @@ __unregister_atfork (void *dso_handle) } next = (*handlers)->next; - if (next) + if (next != NULL) next->prev = prev; *handlers = next; } diff --git a/pthread/pt-exit.c b/pthread/pt-exit.c index 314bfd4..8f3d755 100644 --- a/pthread/pt-exit.c +++ b/pthread/pt-exit.c @@ -41,7 +41,7 @@ __pthread_exit (void *status) pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate); for (handlers = __pthread_get_cleanup_stack (); - *handlers; + *handlers != NULL; *handlers = (*handlers)->__next) (*handlers)->__handler ((*handlers)->__arg); diff --git a/pthread/pt-join.c b/pthread/pt-join.c index 1150b33..329163d 100644 --- a/pthread/pt-join.c +++ b/pthread/pt-join.c @@ -50,7 +50,7 @@ pthread_join (pthread_t thread, void **status) { case PTHREAD_EXITED: /* THREAD has already exited. Salvage its exit status. */ - if (status) + if (status != NULL) *status = pthread->status; __pthread_mutex_unlock (&pthread->state_lock); diff --git a/pthread/pt-self.c b/pthread/pt-self.c index 44e43dd..0f932ac 100644 --- a/pthread/pt-self.c +++ b/pthread/pt-self.c @@ -25,7 +25,7 @@ pthread_t __pthread_self (void) { struct __pthread *self = _pthread_self (); - assert (self); + assert (self != NULL); return self->thread; } diff --git a/pthread/pt-setcancelstate.c b/pthread/pt-setcancelstate.c index b015f87..de5c688 100644 --- a/pthread/pt-setcancelstate.c +++ b/pthread/pt-setcancelstate.c @@ -35,7 +35,7 @@ __pthread_setcancelstate (int state, int *oldstate) } __pthread_mutex_lock (&p->cancel_lock); - if (oldstate) + if (oldstate != NULL) *oldstate = p->cancel_state; p->cancel_state = state; __pthread_mutex_unlock (&p->cancel_lock); diff --git a/pthread/pt-setcanceltype.c b/pthread/pt-setcanceltype.c index f17a0f8..0f29a43 100644 --- a/pthread/pt-setcanceltype.c +++ b/pthread/pt-setcanceltype.c @@ -35,7 +35,7 @@ __pthread_setcanceltype (int type, int *oldtype) } __pthread_mutex_lock (&p->cancel_lock); - if (oldtype) + if (oldtype != NULL) *oldtype = p->cancel_type; p->cancel_type = type; __pthread_mutex_unlock (&p->cancel_lock); diff --git a/sysdeps/generic/pt-cond-signal.c b/sysdeps/generic/pt-cond-signal.c index 68bd6d9..a1c0c2a 100644 --- a/sysdeps/generic/pt-cond-signal.c +++ b/sysdeps/generic/pt-cond-signal.c @@ -29,11 +29,11 @@ __pthread_cond_signal (pthread_cond_t *cond) __pthread_spin_lock (&cond->__lock); wakeup = cond->__queue; - if (wakeup) + if (wakeup != NULL) __pthread_dequeue (wakeup); __pthread_spin_unlock (&cond->__lock); - if (wakeup) + if (wakeup != NULL) __pthread_wakeup (wakeup); return 0; diff --git a/sysdeps/generic/pt-cond-timedwait.c b/sysdeps/generic/pt-cond-timedwait.c index e40958a..525e63d 100644 --- a/sysdeps/generic/pt-cond-timedwait.c +++ b/sysdeps/generic/pt-cond-timedwait.c @@ -108,7 +108,7 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond, already unblocked, progressing on the return path. */ __pthread_spin_lock (&cond->__lock); __pthread_enqueue (&cond->__queue, self); - if (cond->__attr) + if (cond->__attr != NULL) clock_id = cond->__attr->__clock; __pthread_spin_unlock (&cond->__lock); } @@ -121,7 +121,7 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond, __pthread_mutex_unlock (mutex); /* Block the thread. */ - if (abstime) + if (abstime != NULL) err = __pthread_timedblock (self, abstime, clock_id); else { diff --git a/sysdeps/generic/pt-destroy-specific.c b/sysdeps/generic/pt-destroy-specific.c index cb6affe..523a620 100644 --- a/sysdeps/generic/pt-destroy-specific.c +++ b/sysdeps/generic/pt-destroy-specific.c @@ -49,7 +49,7 @@ __pthread_destroy_specific (struct __pthread *thread) continue; value = thread->thread_specifics[i]; - if (value) + if (value != NULL) { thread->thread_specifics[i] = 0; diff --git a/sysdeps/generic/pt-mutex-timedlock.c b/sysdeps/generic/pt-mutex-timedlock.c index b23680a..2a64c53 100644 --- a/sysdeps/generic/pt-mutex-timedlock.c +++ b/sysdeps/generic/pt-mutex-timedlock.c @@ -46,7 +46,7 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, #ifdef ALWAYS_TRACK_MUTEX_OWNER # ifndef NDEBUG self = _pthread_self (); - if (self) + if (self != NULL) /* The main thread may take a lock before the library is fully initialized, in particular, before the main thread has a TCB. */ @@ -57,7 +57,7 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, # endif #endif - if (attr) + if (attr != NULL) switch (attr->__mutex_type) { case PTHREAD_MUTEX_NORMAL: @@ -115,11 +115,11 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, } #if !defined(ALWAYS_TRACK_MUTEX_OWNER) - if (attr && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) + if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) #endif assert (mutex->__owner); - if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) + if (abstime != NULL && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) return EINVAL; /* Add ourselves to the queue. */ @@ -127,7 +127,7 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, __pthread_spin_unlock (&mutex->__lock); /* Block the thread. */ - if (abstime) + if (abstime != NULL) err = __pthread_timedblock (self, abstime, CLOCK_REALTIME); else { @@ -161,13 +161,13 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex, } #if !defined(ALWAYS_TRACK_MUTEX_OWNER) - if (attr && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) + if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL) #endif { assert (mutex->__owner == self); } - if (attr) + if (attr != NULL) switch (attr->__mutex_type) { case PTHREAD_MUTEX_NORMAL: diff --git a/sysdeps/generic/pt-mutex-transfer-np.c b/sysdeps/generic/pt-mutex-transfer-np.c index 926e09e..e208ac1 100644 --- a/sysdeps/generic/pt-mutex-transfer-np.c +++ b/sysdeps/generic/pt-mutex-transfer-np.c @@ -42,7 +42,7 @@ __pthread_mutex_transfer_np (struct __pthread_mutex *mutex, pthread_t tid) if (attr == __PTHREAD_RECURSIVE_MUTEXATTR) attr = &__pthread_recursive_mutexattr; - if (attr && attr->__mutex_type == PTHREAD_MUTEX_ERRORCHECK) + if (attr != NULL && attr->__mutex_type == PTHREAD_MUTEX_ERRORCHECK) { if (mutex->__owner != _pthread_self ()) diff --git a/sysdeps/generic/pt-mutex-trylock.c b/sysdeps/generic/pt-mutex-trylock.c index 3a0fcfe..b19611b 100644 --- a/sysdeps/generic/pt-mutex-trylock.c +++ b/sysdeps/generic/pt-mutex-trylock.c @@ -40,9 +40,9 @@ __pthread_mutex_trylock (struct __pthread_mutex *mutex) /* Acquired the lock. */ { #if defined(ALWAYS_TRACK_MUTEX_OWNER) -#ifndef NDEBUG +# ifndef NDEBUG self = _pthread_self (); - if (self) + if (self != NULL) /* The main thread may take a lock before the library is fully initialized, in particular, before the main thread has a TCB. */ @@ -50,10 +50,10 @@ __pthread_mutex_trylock (struct __pthread_mutex *mutex) assert (mutex->__owner == NULL); mutex->__owner = _pthread_self (); } -#endif +# endif #endif - if (attr) + if (attr != NULL) switch (attr->__mutex_type) { case PTHREAD_MUTEX_NORMAL: @@ -75,7 +75,7 @@ __pthread_mutex_trylock (struct __pthread_mutex *mutex) err = EBUSY; - if (attr) + if (attr != NULL) { self = _pthread_self (); switch (attr->__mutex_type) diff --git a/sysdeps/generic/pt-rwlock-timedrdlock.c b/sysdeps/generic/pt-rwlock-timedrdlock.c index 4d46f7a..60dd97f 100644 --- a/sysdeps/generic/pt-rwlock-timedrdlock.c +++ b/sysdeps/generic/pt-rwlock-timedrdlock.c @@ -60,7 +60,7 @@ __pthread_rwlock_timedrdlock_internal (struct __pthread_rwlock *rwlock, /* Better be blocked by a writer. */ assert (rwlock->__readers == 0); - if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) + if (abstime != NULL && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) return EINVAL; self = _pthread_self (); @@ -70,7 +70,7 @@ __pthread_rwlock_timedrdlock_internal (struct __pthread_rwlock *rwlock, __pthread_spin_unlock (&rwlock->__lock); /* Block the thread. */ - if (abstime) + if (abstime != NULL) err = __pthread_timedblock (self, abstime, CLOCK_REALTIME); else { diff --git a/sysdeps/generic/pt-rwlock-timedwrlock.c b/sysdeps/generic/pt-rwlock-timedwrlock.c index 8a2a469..b30c250 100644 --- a/sysdeps/generic/pt-rwlock-timedwrlock.c +++ b/sysdeps/generic/pt-rwlock-timedwrlock.c @@ -46,7 +46,7 @@ __pthread_rwlock_timedwrlock_internal (struct __pthread_rwlock *rwlock, /* The lock is busy. */ - if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) + if (abstime != NULL && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) return EINVAL; self = _pthread_self (); @@ -56,7 +56,7 @@ __pthread_rwlock_timedwrlock_internal (struct __pthread_rwlock *rwlock, __pthread_spin_unlock (&rwlock->__lock); /* Block the thread. */ - if (abstime) + if (abstime != NULL) err = __pthread_timedblock (self, abstime, CLOCK_REALTIME); else { diff --git a/sysdeps/generic/raise.c b/sysdeps/generic/raise.c index 4571ef0..d2f21c8 100644 --- a/sysdeps/generic/raise.c +++ b/sysdeps/generic/raise.c @@ -32,7 +32,7 @@ raise (int signo) "the effect of the raise() function shall be equivalent to calling: pthread_kill(pthread_self(), sig);" */ - if (__pthread_kill && __pthread_threads) + if (__pthread_kill != NULL && __pthread_threads != NULL) { int err; err = __pthread_kill (__pthread_self (), signo); diff --git a/sysdeps/generic/sem-timedwait.c b/sysdeps/generic/sem-timedwait.c index f3dda4d..54a4ea4 100644 --- a/sysdeps/generic/sem-timedwait.c +++ b/sysdeps/generic/sem-timedwait.c @@ -39,7 +39,7 @@ __sem_timedwait_internal (sem_t *restrict sem, return 0; } - if (timeout && (timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000)) + if (timeout != NULL && (timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000)) { errno = EINVAL; return -1; @@ -52,7 +52,7 @@ __sem_timedwait_internal (sem_t *restrict sem, __pthread_spin_unlock (&sem->__lock); /* Block the thread. */ - if (timeout) + if (timeout != NULL) err = __pthread_timedblock (self, timeout, CLOCK_REALTIME); else { diff --git a/sysdeps/mach/hurd/i386/pt-setup.c b/sysdeps/mach/hurd/i386/pt-setup.c index b498e50..a59f71b 100644 --- a/sysdeps/mach/hurd/i386/pt-setup.c +++ b/sysdeps/mach/hurd/i386/pt-setup.c @@ -49,7 +49,7 @@ stack_setup (struct __pthread *thread, + ((thread->guardsize + __vm_page_size - 1) / __vm_page_size) * __vm_page_size); - if (start_routine) + if (start_routine != NULL) { /* And then the call frame. */ top -= 3; diff --git a/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c b/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c index 182a7e2..41792e3 100644 --- a/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c +++ b/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c @@ -69,7 +69,7 @@ __pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond, assert (ss->intr_port == MACH_PORT_NULL); /* Sanity check for signal bugs. */ - if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) + if (abstime != NULL && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) return EINVAL; /* Atomically enqueue our thread on the condition variable's queue of @@ -111,7 +111,7 @@ __pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond, __pthread_mutex_unlock (mutex); /* Block the thread. */ - if (abstime) + if (abstime != NULL) err = __pthread_timedblock (self, abstime, clock_id); else { @@ -153,7 +153,7 @@ __pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond, ss->cancel = 0; __spin_unlock (&ss->lock); - if (mutex) + if (mutex != NULL) /* Reacquire the mutex and return. */ __pthread_mutex_lock (mutex); diff --git a/sysdeps/mach/hurd/pt-sigstate.c b/sysdeps/mach/hurd/pt-sigstate.c index bdc71c9..890fd57 100644 --- a/sysdeps/mach/hurd/pt-sigstate.c +++ b/sysdeps/mach/hurd/pt-sigstate.c @@ -37,10 +37,10 @@ __pthread_sigstate (struct __pthread *thread, int how, _hurd_sigstate_lock (ss); - if (oset) + if (oset != NULL) *oset = ss->blocked; - if (set) + if (set != NULL) { switch (how) { diff --git a/sysdeps/mach/hurd/pt-sysdep.c b/sysdeps/mach/hurd/pt-sysdep.c index 118b264..40ebc8e 100644 --- a/sysdeps/mach/hurd/pt-sysdep.c +++ b/sysdeps/mach/hurd/pt-sysdep.c @@ -44,14 +44,14 @@ _init_routine (void *stack) int err; pthread_attr_t attr, *attrp = 0; - if (__pthread_threads) + if (__pthread_threads != NULL) /* Already initialized */ return 0; /* Initialize the library. */ ___pthread_init (); - if (stack) + if (stack != NULL) { /* We are getting initialized due to dlopening a library using libpthread while the main program was not linked against libpthread. */ |