aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2003-12-11 01:07:05 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2003-12-11 01:07:05 +0000
commit9ed5893de41742d85535cf4f6745b521a2a42740 (patch)
treee53d1a3db708e3ffa3537b07551c22e922526786
parent78ce6a1e75410873e280290442438a35eb9c3c50 (diff)
Ian's fix for malloc(0) which returns NULL on DEC machines and thus were
treated as an error. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@427 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r--src/SetupGroup.c2
-rw-r--r--src/SetupPGV.c6
2 files changed, 3 insertions, 5 deletions
diff --git a/src/SetupGroup.c b/src/SetupGroup.c
index 6b2763c..029419f 100644
--- a/src/SetupGroup.c
+++ b/src/SetupGroup.c
@@ -134,7 +134,7 @@ static int PUGH_SetupGAGroup (pGH *newGH,
so initialize them to zero */
perme = calloc (dim, sizeof (int));
nprocs = calloc (dim, sizeof (int));
- if (! (perme && nprocs))
+ if (dim && ! (perme && nprocs))
{
CCTK_WARN (0, "Memory allocation error in PUGH_SetupGAGroup");
}
diff --git a/src/SetupPGV.c b/src/SetupPGV.c
index 3eca95e..05ead64 100644
--- a/src/SetupPGV.c
+++ b/src/SetupPGV.c
@@ -192,7 +192,7 @@ pConnectivity *PUGH_SetupConnectivity(int dim,
this->perme = malloc(dim*sizeof(int));
this->neighbours = malloc(total_procs*sizeof(int *));
- if(this->neighbours)
+ if(! dim || this->neighbours)
{
this->neighbours[0] = malloc(total_procs*2*dim*sizeof(int));
}
@@ -203,9 +203,7 @@ pConnectivity *PUGH_SetupConnectivity(int dim,
}
- if(!this->nprocs ||
- !this->perme ||
- !this->neighbours)
+ if((dim && ! this->nprocs) || (dim && ! this->perme) || ! this->neighbours)
{
if(this->neighbours)
{