From 9ed5893de41742d85535cf4f6745b521a2a42740 Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 11 Dec 2003 01:07:05 +0000 Subject: 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 --- src/SetupGroup.c | 2 +- src/SetupPGV.c | 6 ++---- 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) { -- cgit v1.2.3