aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2004-05-14 13:54:40 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2004-05-14 13:54:40 +0000
commit6bee352f614f47195c4d4014457df779ce96b9b3 (patch)
tree5697fbc2ff807dc9e5c27bc068d1b0419ebd9994
parent2f928fc2c89ce8946fc2300f97a9412530540d55 (diff)
Fixed gcc compiler warnings about potentially undefined return values.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@439 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r--src/Comm.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/src/Comm.c b/src/Comm.c
index b601982..2159a83 100644
--- a/src/Comm.c
+++ b/src/Comm.c
@@ -82,7 +82,7 @@ int PUGH_SyncGroup(const cGH *GH, const char *groupname)
}
else if (CCTK_NumVarsInGroupI(group) == 0)
{
- /* do nothing */
+ retval = 0; /* do nothing */
}
else
{
@@ -104,7 +104,7 @@ int PUGH_SyncGroup(const cGH *GH, const char *groupname)
indicated by groupname.
@enddesc
@calls PUGH_EnableGArrayGroupComm
-
+
@var GH
@vdesc Pointer to CCTK grid hierarchy
@vtype const cGH *
@@ -296,10 +296,14 @@ int PUGH_DisableGArrayComm(pGA *GA)
@@*/
static int PUGH_SyncGArrayGroup(pGH *pughGH, int first_var)
{
+ int retval;
pGA *firstGA;
- if (first_var<0 || first_var>=CCTK_NumVars()) CCTK_WARN (0, "internal error");
+ if (first_var<0 || first_var>=CCTK_NumVars())
+ {
+ CCTK_WARN (0, "internal error");
+ }
firstGA = (pGA *) pughGH->variables [first_var][0];
@@ -310,13 +314,10 @@ static int PUGH_SyncGArrayGroup(pGH *pughGH, int first_var)
#endif
/* Automatically enable communication for this group. */
-
- PUGH_EnableGArrayGroupComm(pughGH,
- first_var,
- PUGH_ALLCOMM);
-
+ PUGH_EnableGArrayGroupComm(pughGH, first_var, PUGH_ALLCOMM);
+ retval = PUGH_Sync(pughGH, firstGA->groupcomm);
- return (PUGH_Sync(pughGH, firstGA->groupcomm));
+ return (retval);
}
@@ -552,6 +553,10 @@ static int PUGH_EnableComm(pGH *pughGH, pComm *comm, int commflag)
/* allocate memory for communication buffers: 2 faces per direction */
for (i = 0; i < 2 * GA->extras->dim; i++)
{
+ comm->buffer_sz[i] = 0;
+ comm->send_buffer[i] = NULL;
+ comm->recv_buffer[i] = NULL;
+
if (GA->connectivity->neighbours[pughGH->myproc][i] >= 0)
{
dir = i/2;
@@ -575,14 +580,8 @@ static int PUGH_EnableComm(pGH *pughGH, pComm *comm, int commflag)
{
for (; i >=0 ; i--)
{
- if (comm->send_buffer[i])
- {
- free(comm->send_buffer[i]);
- }
- if (comm->recv_buffer[i])
- {
- free(comm->recv_buffer[i]);
- }
+ free(comm->send_buffer[i]);
+ free(comm->recv_buffer[i]);
comm->buffer_sz[i] = 0;
}
@@ -591,18 +590,6 @@ static int PUGH_EnableComm(pGH *pughGH, pComm *comm, int commflag)
break;
}
}
- else
- {
- comm->buffer_sz[i] = 0;
- comm->send_buffer[i] = NULL;
- comm->recv_buffer[i] = NULL;
- }
- }
- else /* no neighbor -> no comm buffers */
- {
- comm->buffer_sz[i] = 0;
- comm->send_buffer[i] = NULL;
- comm->recv_buffer[i] = NULL;
}
}
}
@@ -982,7 +969,7 @@ static int PUGH_SyncSingleProc(pGH *pughGH, pComm *comm)
{
CCTK_VWarn(2, __LINE__, __FILE__, CCTK_THORNSTRING,
"Trying to synchronize variable '%s' with no storage", GA->name);
- return;
+ return (0);
}
/* since we need to iterators here we need to allocate one */