summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-03-28 01:39:41 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-03-28 01:39:41 +0200
commit3849b385c44d8d8a2332c826e18d31cff7327e45 (patch)
tree7c00561a25e703446598315326a13a3a8b9a01b2
parent08ed02b9705b7bce1b8d79da6455d59a31295212 (diff)
Fix coding style
-rw-r--r--forward.c6
-rw-r--r--pthread/pt-create.c6
-rw-r--r--sysdeps/generic/pt-barrier-init.c4
-rw-r--r--sysdeps/generic/pt-cond-init.c5
-rw-r--r--sysdeps/generic/pt-cond-timedwait.c2
-rw-r--r--sysdeps/generic/pt-destroy-specific.c2
-rw-r--r--sysdeps/generic/pt-key-create.c2
-rw-r--r--sysdeps/generic/pt-mutex-init.c7
-rw-r--r--sysdeps/generic/pt-mutex-timedlock.c10
-rw-r--r--sysdeps/generic/pt-mutex-transfer-np.c4
-rw-r--r--sysdeps/generic/pt-mutex-trylock.c2
-rw-r--r--sysdeps/generic/pt-mutex-unlock.c4
-rw-r--r--sysdeps/generic/pt-rwlock-init.c4
-rw-r--r--sysdeps/generic/pt-rwlock-timedrdlock.c2
-rw-r--r--sysdeps/generic/pt-rwlock-timedwrlock.c2
-rw-r--r--sysdeps/generic/pt-setspecific.c2
-rw-r--r--sysdeps/generic/sem-post.c4
-rw-r--r--sysdeps/generic/sem-timedwait.c2
-rw-r--r--sysdeps/hurd/pt-kill.c2
-rw-r--r--sysdeps/mach/hurd/pt-hurd-cond-timedwait.c2
-rw-r--r--sysdeps/mach/hurd/pt-mutex-transfer-np.c2
21 files changed, 39 insertions, 37 deletions
diff --git a/forward.c b/forward.c
index 7af61b9..7c002fe 100644
--- a/forward.c
+++ b/forward.c
@@ -171,7 +171,7 @@ atfork_pthread_prepare (void)
last_handler = fork_last_handler;
__libc_lock_unlock (atfork_lock);
- if (!last_handler)
+ if (last_handler == NULL)
return;
while (1)
@@ -228,7 +228,7 @@ __register_atfork (void (*prepare) (void),
void *dso_handle)
{
struct atfork *new = malloc (sizeof (*new));
- if (!new)
+ if (new == NULL)
return errno;
new->prepare = prepare;
@@ -242,7 +242,7 @@ __register_atfork (void (*prepare) (void),
if (fork_handlers)
fork_handlers->prev = new;
fork_handlers = new;
- if (!fork_last_handler)
+ if (fork_last_handler == NULL)
fork_last_handler = new;
__libc_lock_unlock (atfork_lock);
diff --git a/pthread/pt-create.c b/pthread/pt-create.c
index 0b70f77..f5c06ff 100644
--- a/pthread/pt-create.c
+++ b/pthread/pt-create.c
@@ -101,13 +101,13 @@ __pthread_create_internal (struct __pthread **thread,
setup = attr ? attr : &__pthread_default_attr;
stacksize = setup->__stacksize;
- if (!stacksize)
+ if (stacksize == 0)
{
struct rlimit rlim;
__getrlimit (RLIMIT_STACK, &rlim);
if (rlim.rlim_cur != RLIM_INFINITY)
stacksize = rlim.rlim_cur;
- if (!stacksize)
+ if (stacksize == 0)
stacksize = PTHREAD_STACK_DEFAULT;
}
@@ -146,7 +146,7 @@ __pthread_create_internal (struct __pthread **thread,
goto failed_thread_alloc;
pthread->tcb = _dl_allocate_tls (NULL);
- if (!pthread->tcb)
+ if (pthread->tcb == NULL)
{
err = ENOMEM;
goto failed_thread_tls_alloc;
diff --git a/sysdeps/generic/pt-barrier-init.c b/sysdeps/generic/pt-barrier-init.c
index a3a2c68..8f652d7 100644
--- a/sysdeps/generic/pt-barrier-init.c
+++ b/sysdeps/generic/pt-barrier-init.c
@@ -35,7 +35,7 @@ pthread_barrier_init (pthread_barrier_t *barrier,
barrier->__pending = count;
barrier->__count = count;
- if (!attr
+ if (attr == NULL
|| memcmp (attr, &__pthread_default_barrierattr, sizeof (*attr) == 0))
/* Use the default attributes. */
return 0;
@@ -43,7 +43,7 @@ pthread_barrier_init (pthread_barrier_t *barrier,
/* Non-default attributes. */
barrier->__attr = malloc (sizeof *attr);
- if (!barrier->__attr)
+ if (barrier->__attr == NULL)
return ENOMEM;
*barrier->__attr = *attr;
diff --git a/sysdeps/generic/pt-cond-init.c b/sysdeps/generic/pt-cond-init.c
index e1ccf3b..4c128ac 100644
--- a/sysdeps/generic/pt-cond-init.c
+++ b/sysdeps/generic/pt-cond-init.c
@@ -27,14 +27,15 @@ __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t * attr)
{
*cond = (pthread_cond_t) __PTHREAD_COND_INITIALIZER;
- if (!attr || memcmp (attr, &__pthread_default_condattr, sizeof (*attr) == 0))
+ if (attr == NULL
+ || memcmp (attr, &__pthread_default_condattr, sizeof (*attr) == 0))
/* Use the default attributes. */
return 0;
/* Non-default attributes. */
cond->__attr = malloc (sizeof *attr);
- if (!cond->__attr)
+ if (cond->__attr == NULL)
return ENOMEM;
*cond->__attr = *attr;
diff --git a/sysdeps/generic/pt-cond-timedwait.c b/sysdeps/generic/pt-cond-timedwait.c
index dd37fe7..e40958a 100644
--- a/sysdeps/generic/pt-cond-timedwait.c
+++ b/sysdeps/generic/pt-cond-timedwait.c
@@ -130,7 +130,7 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond,
}
__pthread_spin_lock (&cond->__lock);
- if (!self->prevp)
+ if (self->prevp == NULL)
{
/* Another thread removed us from the list of waiters, which means a
wakeup message has been sent. It was either consumed while we were
diff --git a/sysdeps/generic/pt-destroy-specific.c b/sysdeps/generic/pt-destroy-specific.c
index fd1b427..cb6affe 100644
--- a/sysdeps/generic/pt-destroy-specific.c
+++ b/sysdeps/generic/pt-destroy-specific.c
@@ -28,7 +28,7 @@ __pthread_destroy_specific (struct __pthread *thread)
int seen_one;
/* Check if there is any thread specific data. */
- if (!thread->thread_specifics)
+ if (thread->thread_specifics == NULL)
return;
__pthread_key_lock_ready ();
diff --git a/sysdeps/generic/pt-key-create.c b/sysdeps/generic/pt-key-create.c
index 81f237e..194acc3 100644
--- a/sysdeps/generic/pt-key-create.c
+++ b/sysdeps/generic/pt-key-create.c
@@ -85,7 +85,7 @@ do_search:
t = realloc (__pthread_key_destructors,
newsize * sizeof (*__pthread_key_destructors));
- if (!t)
+ if (t == NULL)
{
__pthread_mutex_unlock (&__pthread_key_lock);
return ENOMEM;
diff --git a/sysdeps/generic/pt-mutex-init.c b/sysdeps/generic/pt-mutex-init.c
index 91e3b70..ee3ca9a 100644
--- a/sysdeps/generic/pt-mutex-init.c
+++ b/sysdeps/generic/pt-mutex-init.c
@@ -28,16 +28,17 @@ _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
*mutex = (pthread_mutex_t) __PTHREAD_MUTEX_INITIALIZER;
- if (!attr || memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr) == 0))
+ if (attr == NULL
+ || memcmp (attr, &__pthread_default_mutexattr, sizeof (*attr) == 0))
/* The default attributes. */
return 0;
- if (!mutex->__attr
+ if (mutex->__attr == NULL
|| mutex->__attr == __PTHREAD_ERRORCHECK_MUTEXATTR
|| mutex->__attr == __PTHREAD_RECURSIVE_MUTEXATTR)
mutex->__attr = malloc (sizeof *attr);
- if (!mutex->__attr)
+ if (mutex->__attr == NULL)
return ENOMEM;
*mutex->__attr = *attr;
diff --git a/sysdeps/generic/pt-mutex-timedlock.c b/sysdeps/generic/pt-mutex-timedlock.c
index 992d32e..b23680a 100644
--- a/sysdeps/generic/pt-mutex-timedlock.c
+++ b/sysdeps/generic/pt-mutex-timedlock.c
@@ -44,17 +44,17 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex,
/* Successfully acquired the lock. */
{
#ifdef ALWAYS_TRACK_MUTEX_OWNER
-#ifndef NDEBUG
+# ifndef NDEBUG
self = _pthread_self ();
if (self)
/* The main thread may take a lock before the library is fully
initialized, in particular, before the main thread has a
TCB. */
{
- assert (!mutex->__owner);
+ assert (mutex->__owner == NULL);
mutex->__owner = _pthread_self ();
}
-#endif
+# endif
#endif
if (attr)
@@ -82,7 +82,7 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex,
self = _pthread_self ();
assert (self);
- if (!attr || attr->__mutex_type == PTHREAD_MUTEX_NORMAL)
+ if (attr == NULL || attr->__mutex_type == PTHREAD_MUTEX_NORMAL)
{
#if defined(ALWAYS_TRACK_MUTEX_OWNER)
assert (mutex->__owner != self);
@@ -136,7 +136,7 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex,
}
__pthread_spin_lock (&mutex->__lock);
- if (!self->prevp)
+ if (self->prevp == NULL)
/* Another thread removed us from the queue, which means a wakeup message
has been sent. It was either consumed while we were blocking, or
queued after we timed out and before we acquired the mutex lock, in
diff --git a/sysdeps/generic/pt-mutex-transfer-np.c b/sysdeps/generic/pt-mutex-transfer-np.c
index e57d144..926e09e 100644
--- a/sysdeps/generic/pt-mutex-transfer-np.c
+++ b/sysdeps/generic/pt-mutex-transfer-np.c
@@ -31,7 +31,7 @@ __pthread_mutex_transfer_np (struct __pthread_mutex *mutex, pthread_t tid)
struct __pthread *thread = __pthread_getid (tid);
const struct __pthread_mutexattr *attr = mutex->__attr;
- if (!thread)
+ if (thread == NULL)
return ESRCH;
if (thread == _pthread_self ())
@@ -53,7 +53,7 @@ __pthread_mutex_transfer_np (struct __pthread_mutex *mutex, pthread_t tid)
#ifndef NDEBUG
# if !defined(ALWAYS_TRACK_MUTEX_OWNER)
- if (attr && attr->__mutex_type != PTHREAD_MUTEX_NORMAL)
+ if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL)
# endif
{
mutex->__owner = thread;
diff --git a/sysdeps/generic/pt-mutex-trylock.c b/sysdeps/generic/pt-mutex-trylock.c
index 179222f..3a0fcfe 100644
--- a/sysdeps/generic/pt-mutex-trylock.c
+++ b/sysdeps/generic/pt-mutex-trylock.c
@@ -47,7 +47,7 @@ __pthread_mutex_trylock (struct __pthread_mutex *mutex)
initialized, in particular, before the main thread has a
TCB. */
{
- assert (!mutex->__owner);
+ assert (mutex->__owner == NULL);
mutex->__owner = _pthread_self ();
}
#endif
diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c
index 08e74ca..e46a913 100644
--- a/sysdeps/generic/pt-mutex-unlock.c
+++ b/sysdeps/generic/pt-mutex-unlock.c
@@ -36,7 +36,7 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex)
__pthread_spin_lock (&mutex->__lock);
- if (!attr || attr->__mutex_type == PTHREAD_MUTEX_NORMAL)
+ if (attr == NULL || attr->__mutex_type == PTHREAD_MUTEX_NORMAL)
{
#if defined(ALWAYS_TRACK_MUTEX_OWNER)
# ifndef NDEBUG
@@ -87,7 +87,7 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex)
#ifndef NDEBUG
# if !defined (ALWAYS_TRACK_MUTEX_OWNER)
- if (attr && attr->__mutex_type != PTHREAD_MUTEX_NORMAL)
+ if (attr != NULL && attr->__mutex_type != PTHREAD_MUTEX_NORMAL)
# endif
{
mutex->__owner = wakeup;
diff --git a/sysdeps/generic/pt-rwlock-init.c b/sysdeps/generic/pt-rwlock-init.c
index 0009801..0ef8432 100644
--- a/sysdeps/generic/pt-rwlock-init.c
+++ b/sysdeps/generic/pt-rwlock-init.c
@@ -26,7 +26,7 @@ _pthread_rwlock_init (pthread_rwlock_t *rwlock,
{
*rwlock = (pthread_rwlock_t) __PTHREAD_RWLOCK_INITIALIZER;
- if (!attr
+ if (attr == NULL
|| memcmp (attr, &__pthread_default_rwlockattr, sizeof (*attr) == 0))
/* Use the default attributes. */
return 0;
@@ -34,7 +34,7 @@ _pthread_rwlock_init (pthread_rwlock_t *rwlock,
/* Non-default attributes. */
rwlock->__attr = malloc (sizeof *attr);
- if (!rwlock->__attr)
+ if (rwlock->__attr == NULL)
return ENOMEM;
*rwlock->__attr = *attr;
diff --git a/sysdeps/generic/pt-rwlock-timedrdlock.c b/sysdeps/generic/pt-rwlock-timedrdlock.c
index fe0c224..4d46f7a 100644
--- a/sysdeps/generic/pt-rwlock-timedrdlock.c
+++ b/sysdeps/generic/pt-rwlock-timedrdlock.c
@@ -79,7 +79,7 @@ __pthread_rwlock_timedrdlock_internal (struct __pthread_rwlock *rwlock,
}
__pthread_spin_lock (&rwlock->__lock);
- if (!self->prevp)
+ if (self->prevp == NULL)
/* Another thread removed us from the queue, which means a wakeup message
has been sent. It was either consumed while we were blocking, or
queued after we timed out and before we acquired the rwlock lock, in
diff --git a/sysdeps/generic/pt-rwlock-timedwrlock.c b/sysdeps/generic/pt-rwlock-timedwrlock.c
index 3a3faad..8a2a469 100644
--- a/sysdeps/generic/pt-rwlock-timedwrlock.c
+++ b/sysdeps/generic/pt-rwlock-timedwrlock.c
@@ -65,7 +65,7 @@ __pthread_rwlock_timedwrlock_internal (struct __pthread_rwlock *rwlock,
}
__pthread_spin_lock (&rwlock->__lock);
- if (!self->prevp)
+ if (self->prevp == NULL)
/* Another thread removed us from the queue, which means a wakeup message
has been sent. It was either consumed while we were blocking, or
queued after we timed out and before we acquired the rwlock lock, in
diff --git a/sysdeps/generic/pt-setspecific.c b/sysdeps/generic/pt-setspecific.c
index e82c7ae..8492b5d 100644
--- a/sysdeps/generic/pt-setspecific.c
+++ b/sysdeps/generic/pt-setspecific.c
@@ -35,7 +35,7 @@ __pthread_setspecific (pthread_key_t key, const void *value)
int newsize = 2 * key + 1;
void **new = realloc (self->thread_specifics,
newsize * sizeof (new[0]));
- if (!new)
+ if (new == NULL)
return ENOMEM;
memset (&new[self->thread_specifics_size], 0,
diff --git a/sysdeps/generic/sem-post.c b/sysdeps/generic/sem-post.c
index f374a62..12cb36c 100644
--- a/sysdeps/generic/sem-post.c
+++ b/sysdeps/generic/sem-post.c
@@ -30,13 +30,13 @@ __sem_post (sem_t *sem)
if (sem->__value > 0)
/* Do a quick up. */
{
- assert (!sem->__queue);
+ assert (sem->__queue == NULL);
sem->__value++;
__pthread_spin_unlock (&sem->__lock);
return 0;
}
- if (!sem->__queue)
+ if (sem->__queue == NULL)
/* No one waiting. */
{
sem->__value = 1;
diff --git a/sysdeps/generic/sem-timedwait.c b/sysdeps/generic/sem-timedwait.c
index a70ca89..f3dda4d 100644
--- a/sysdeps/generic/sem-timedwait.c
+++ b/sysdeps/generic/sem-timedwait.c
@@ -61,7 +61,7 @@ __sem_timedwait_internal (sem_t *restrict sem,
}
__pthread_spin_lock (&sem->__lock);
- if (!self->prevp)
+ if (self->prevp == NULL)
/* Another thread removed us from the queue, which means a wakeup message
has been sent. It was either consumed while we were blocking, or
queued after we timed out and before we acquired the semaphore lock, in
diff --git a/sysdeps/hurd/pt-kill.c b/sysdeps/hurd/pt-kill.c
index d1605e8..5b72701 100644
--- a/sysdeps/hurd/pt-kill.c
+++ b/sysdeps/hurd/pt-kill.c
@@ -38,7 +38,7 @@ __pthread_kill (pthread_t thread, int sig)
ss = _hurd_thread_sigstate (pthread->kernel_thread);
assert (ss);
- if (!sig)
+ if (sig == 0)
return 0;
detail.exc = 0;
diff --git a/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c b/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c
index 93dc25c..a4e8fe9 100644
--- a/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c
+++ b/sysdeps/mach/hurd/pt-hurd-cond-timedwait.c
@@ -122,7 +122,7 @@ __pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond,
suspending us while the condition lock is held. */
__spin_lock (&ss->lock);
__pthread_spin_lock (&cond->__lock);
- if (! self->prevp)
+ if (self->prevp == NULL)
/* Another thread removed us from the list of waiters, which means
a wakeup message has been sent. It was either consumed while
we were blocking, or queued after we timed out and before we
diff --git a/sysdeps/mach/hurd/pt-mutex-transfer-np.c b/sysdeps/mach/hurd/pt-mutex-transfer-np.c
index 794f325..dc70909 100644
--- a/sysdeps/mach/hurd/pt-mutex-transfer-np.c
+++ b/sysdeps/mach/hurd/pt-mutex-transfer-np.c
@@ -28,7 +28,7 @@ int __pthread_mutex_transfer_np (pthread_mutex_t *mtxp, pthread_t th)
struct __pthread *self = _pthread_self ();
struct __pthread *pt = __pthread_getid (th);
- if (!pt)
+ if (pt == NULL)
return (ESRCH);
else if (pt == self)
return (0);