[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 901dccc 4/4: Removed -junk- variable in pthrea
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 901dccc 4/4: Removed -junk- variable in pthread_barrier_init |
Date: |
Wed, 7 Sep 2016 17:07:05 +0000 (UTC) |
branch: master
commit 901dccc9bf72637cb8d56615229e2526ca093a8b
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Removed -junk- variable in pthread_barrier_init
The `pthread_barrier_init' function is used in systems that don't have this
POSIX function (in particular Mac OS X). In our implementation of it, to
avoid an unused variable warning, a `junk' integer was defined. However,
while the type of the unused variable was `pthread_barrierattr_t', the junk
variable was `int'! So some Mac OS X compilers would get a segmentation
fault or hang when running `make check' and abort.
The junk variable is now removed and attribute is just left there in the
arguments and unused in the function. So a warning might be issued by the
compiler, but atleast it will not give a segfault during `make check'.
---
lib/threads.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/threads.c b/lib/threads.c
index 208dfda..3d8ca26 100644
--- a/lib/threads.c
+++ b/lib/threads.c
@@ -46,10 +46,9 @@ int
pthread_barrier_init(pthread_barrier_t *b, pthread_barrierattr_t *attr,
unsigned int count)
{
- int err, junk=*attr;
+ int err;
/* Sanity check: */
- junk=junk+1; /* So there is no unused variable warning. */
if(count==0)
{
errno = EINVAL;
@@ -143,7 +142,7 @@ pthread_barrier_wait(pthread_barrier_t *b)
(size_t) -1, which is larger than any possible index!. */
void
gal_threads_dist_in_threads(size_t nindexs, size_t nthrds, size_t **outthrds,
- size_t *outthrdcols)
+ size_t *outthrdcols)
{
size_t *sp, *fp;
size_t i, *thrds, thrdcols;