Commit 3f4d6a51 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cast malloc return value

parent 1183ed62
...@@ -11,7 +11,7 @@ uint32_t cdiCheckSum(int type, int count, void *buffer) ...@@ -11,7 +11,7 @@ uint32_t cdiCheckSum(int type, int count, void *buffer)
uint32_t s = 0U; uint32_t s = 0U;
xassert(count >= 0); xassert(count >= 0);
size_t elemSize = (size_t)serializeGetSizeInCore(1, type, NULL); size_t elemSize = (size_t)serializeGetSizeInCore(1, type, NULL);
memcrc_r_eswap(&s, buffer, count, elemSize); memcrc_r_eswap(&s, (const unsigned char*) buffer, count, elemSize);
s = memcrc_finish(&s, elemSize * (size_t)count); s = memcrc_finish(&s, elemSize * (size_t)count);
return s; return s;
} }
...@@ -955,7 +955,7 @@ int file_fill_buffer(bfile_t *fileptr) ...@@ -955,7 +955,7 @@ int file_fill_buffer(bfile_t *fileptr)
fileptr->mappedSize = (size_t) nread; fileptr->mappedSize = (size_t) nread;
fileptr->buffer = mmap(NULL, (size_t) nread, PROT_READ, MAP_PRIVATE, fd, fileptr->bufferPos); fileptr->buffer = (char*) mmap(NULL, (size_t) nread, PROT_READ, MAP_PRIVATE, fd, fileptr->bufferPos);
if ( fileptr->buffer == MAP_FAILED ) SysError("mmap error for read %s", fileptr->name); if ( fileptr->buffer == MAP_FAILED ) SysError("mmap error for read %s", fileptr->name);
......
...@@ -4581,7 +4581,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4581,7 +4581,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasRowLonFlag) if (memberMask & gridHasRowLonFlag)
{ {
xassert(gridP->nrowlon); xassert(gridP->nrowlon);
gridP->rowlon = xmalloc(gridP->nrowlon * sizeof (int)); gridP->rowlon = (int*) xmalloc(gridP->nrowlon * sizeof (int));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context); gridP->rowlon, gridP->nrowlon , DATATYPE_INT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4630,7 +4630,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4630,7 +4630,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
else else
size = gridP->xsize; size = gridP->xsize;
gridP->xvals = xmalloc(size * sizeof (double)); gridP->xvals = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->xvals, size, DATATYPE_FLT64, context); gridP->xvals, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4645,7 +4645,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4645,7 +4645,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
else else
size = gridP->ysize; size = gridP->ysize;
gridP->yvals = xmalloc( size * sizeof (double)); gridP->yvals = (double*) xmalloc( size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->yvals, size, DATATYPE_FLT64, context); gridP->yvals, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4656,7 +4656,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4656,7 +4656,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasAreaFlag) if (memberMask & gridHasAreaFlag)
{ {
xassert((size = gridP->size)); xassert((size = gridP->size));
gridP->area = xmalloc(size * sizeof (double)); gridP->area = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->area, size, DATATYPE_FLT64, context); gridP->area, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4672,7 +4672,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4672,7 +4672,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
size = gridP->nvertex * gridP->xsize; size = gridP->nvertex * gridP->xsize;
xassert(size); xassert(size);
gridP->xbounds = xmalloc(size * sizeof (double)); gridP->xbounds = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->xbounds, size, DATATYPE_FLT64, context); gridP->xbounds, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4688,7 +4688,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4688,7 +4688,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
size = gridP->nvertex * gridP->ysize; size = gridP->nvertex * gridP->ysize;
xassert(size); xassert(size);
gridP->ybounds = xmalloc(size * sizeof (double)); gridP->ybounds = (double*) xmalloc(size * sizeof (double));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->ybounds, size, DATATYPE_FLT64, context); gridP->ybounds, size, DATATYPE_FLT64, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4717,7 +4717,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4717,7 +4717,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
int referenceSize; int referenceSize;
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
&referenceSize, 1, DATATYPE_INT, context); &referenceSize, 1, DATATYPE_INT, context);
gridP->reference = xmalloc(referenceSize); gridP->reference = (char*) xmalloc(referenceSize);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->reference, referenceSize, DATATYPE_TXT, context); gridP->reference, referenceSize, DATATYPE_TXT, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4728,7 +4728,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4728,7 +4728,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasMaskFlag) if (memberMask & gridHasMaskFlag)
{ {
xassert((size = gridP->size)); xassert((size = gridP->size));
gridP->mask = xmalloc(size * sizeof (mask_t)); gridP->mask = (mask_t*) xmalloc(size * sizeof (mask_t));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->mask, gridP->size, DATATYPE_UCHAR, context); gridP->mask, gridP->size, DATATYPE_UCHAR, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
...@@ -4739,7 +4739,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4739,7 +4739,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
if (memberMask & gridHasGMEMaskFlag) if (memberMask & gridHasGMEMaskFlag)
{ {
xassert((size = gridP->size)); xassert((size = gridP->size));
gridP->mask_gme = xmalloc(size * sizeof (mask_t)); gridP->mask_gme = (mask_t*) xmalloc(size * sizeof (mask_t));
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context); gridP->mask_gme, gridP->size, DATATYPE_UCHAR, context);
serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos,
......
...@@ -111,7 +111,7 @@ void instituteInit (void) ...@@ -111,7 +111,7 @@ void instituteInit (void)
if ( !instituteInitialized ) if ( !instituteInitialized )
{ {
instituteInitialized = 1; instituteInitialized = 1;
instituteInitializedNsp = xcalloc ( 1, nspc * sizeof ( int )); instituteInitializedNsp = (int*) xcalloc ( 1, nspc * sizeof ( int ));
atexit ( instituteFinalize ); atexit ( instituteFinalize );
} }
...@@ -191,7 +191,7 @@ static enum cdiApplyRet ...@@ -191,7 +191,7 @@ static enum cdiApplyRet
findInstitute(int id, void *res, void *data) findInstitute(int id, void *res, void *data)
{ {
institute_t * ip1 = ((struct instLoc *)data)->ip; institute_t * ip1 = ((struct instLoc *)data)->ip;
institute_t * ip2 = res; institute_t * ip2 = (institute_t*) res;
if (ip2->used && !instituteCompareKernel(ip1, ip2)) if (ip2->used && !instituteCompareKernel(ip1, ip2))
{ {
((struct instLoc *)data)->id = id; ((struct instLoc *)data)->id = id;
...@@ -206,7 +206,7 @@ int institutInq(int center, int subcenter, const char *name, const char *longnam ...@@ -206,7 +206,7 @@ int institutInq(int center, int subcenter, const char *name, const char *longnam
{ {
instituteInit (); instituteInit ();
institute_t * ip_ref = xmalloc(sizeof (*ip_ref)); institute_t * ip_ref = (institute_t*) xmalloc(sizeof (*ip_ref));
ip_ref->self = UNDEFID; ip_ref->self = UNDEFID;
ip_ref->used = 0; ip_ref->used = 0;
ip_ref->center = center; ip_ref->center = center;
...@@ -355,7 +355,7 @@ enum { ...@@ -355,7 +355,7 @@ enum {
static int instituteGetSizeP ( void * instituteptr, void *context) static int instituteGetSizeP ( void * instituteptr, void *context)
{ {
institute_t *p = instituteptr; institute_t *p = (institute_t*) instituteptr;
int txsize = serializeGetSize(institute_nints, DATATYPE_INT, context) int txsize = serializeGetSize(institute_nints, DATATYPE_INT, context)
+ serializeGetSize(strlen(p->name) + 1, DATATYPE_TXT, context) + serializeGetSize(strlen(p->name) + 1, DATATYPE_TXT, context)
+ serializeGetSize(strlen(p->longname) + 1, DATATYPE_TXT, context); + serializeGetSize(strlen(p->longname) + 1, DATATYPE_TXT, context);
...@@ -364,7 +364,7 @@ static int instituteGetSizeP ( void * instituteptr, void *context) ...@@ -364,7 +364,7 @@ static int instituteGetSizeP ( void * instituteptr, void *context)
static void institutePackP(void * instituteptr, void *buf, int size, int *position, void *context) static void institutePackP(void * instituteptr, void *buf, int size, int *position, void *context)
{ {
institute_t *p = instituteptr; institute_t *p = (institute_t*) instituteptr;
int tempbuf[institute_nints]; int tempbuf[institute_nints];
tempbuf[0] = p->self; tempbuf[0] = p->self;
tempbuf[1] = p->center; tempbuf[1] = p->center;
...@@ -382,8 +382,8 @@ int instituteUnpack(void *buf, int size, int *position, int nspTarget, void *con ...@@ -382,8 +382,8 @@ int instituteUnpack(void *buf, int size, int *position, int nspTarget, void *con
int instituteID; int instituteID;
char *name, *longname; char *name, *longname;
serializeUnpack(buf, size, position, tempbuf, institute_nints, DATATYPE_INT, context); serializeUnpack(buf, size, position, tempbuf, institute_nints, DATATYPE_INT, context);
name = xmalloc(tempbuf[3]); name = (char*) xmalloc(tempbuf[3]);
longname = xmalloc(tempbuf[4]); longname = (char*) xmalloc(tempbuf[4]);
serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context); serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
serializeUnpack(buf, size, position, longname, tempbuf[4], DATATYPE_TXT, context); serializeUnpack(buf, size, position, longname, tempbuf[4], DATATYPE_TXT, context);
instituteID = institutDef(tempbuf[1], tempbuf[2], name, longname); instituteID = institutDef(tempbuf[1], tempbuf[2], name, longname);
......
...@@ -257,7 +257,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, ...@@ -257,7 +257,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
maxMatch = maxFunMatch; maxMatch = maxFunMatch;
} }
++maxMatch; ++maxMatch;
reMatch = malloc((size_t)maxMatch * sizeof (reMatch[0])); reMatch = (regmatch_t*) malloc((size_t)maxMatch * sizeof (reMatch[0]));
/* compile comment regular expression */ /* compile comment regular expression */
regex_t commentRE; regex_t commentRE;
{ {
...@@ -309,7 +309,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, ...@@ -309,7 +309,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
fprintf(fpint, "#endif\n"); fprintf(fpint, "#endif\n");
fprintf(fpint, "\n"); fprintf(fpint, "\n");
{ {
char *cppMacro = malloc(strlen(fname) + 2); char *cppMacro = (char*) malloc(strlen(fname) + 2);
build_header_name(fname, cppMacro); build_header_name(fname, cppMacro);
fprintf(fpint, "#if ! defined (%s)\n" fprintf(fpint, "#if ! defined (%s)\n"
"# include \"%s\"\n" "# include \"%s\"\n"
...@@ -407,7 +407,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, ...@@ -407,7 +407,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
if ((extLen = getline(&lineExtension, &extSize, fpin)) <= 0) if ((extLen = getline(&lineExtension, &extSize, fpin)) <= 0)
break; break;
if ((size_t)(lineLen + extLen) >= lineBufSize) if ((size_t)(lineLen + extLen) >= lineBufSize)
if (!(line = realloc(line, (size_t)(lineLen + extLen + 1)))) if (!(line = (char*) realloc(line, (size_t)(lineLen + extLen + 1))))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
memcpy(line + lineLen, lineExtension, (size_t)extLen + 1); memcpy(line + lineLen, lineExtension, (size_t)extLen + 1);
lineLen += extLen; lineLen += extLen;
...@@ -781,7 +781,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, ...@@ -781,7 +781,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint,
} }
/* path to document root, separating /, max of path within root, /* path to document root, separating /, max of path within root,
* terminating '\0' */ * terminating '\0' */
filename = malloc(doc_root_len + 1 + max_len + 1); filename = (char*) malloc(doc_root_len + 1 + max_len + 1);
} }
memcpy(filename, doc_root, doc_root_len); memcpy(filename, doc_root, doc_root_len);
...@@ -991,7 +991,7 @@ reCompile(regex_t *restrict RE, const char *restrict REstring, ...@@ -991,7 +991,7 @@ reCompile(regex_t *restrict RE, const char *restrict REstring,
char *restrict line; char *restrict line;
size_t resize; size_t resize;
if (*lineBufSize < REGEX_MAX_ERRSTRLEN if (*lineBufSize < REGEX_MAX_ERRSTRLEN
&& (line = realloc(*lineBuf, resize = REGEX_MAX_ERRSTRLEN))) && (line = (char*) realloc(*lineBuf, resize = REGEX_MAX_ERRSTRLEN)))
{ {
*lineBuf = line; *lineBuf = line;
*lineBufSize = resize; *lineBufSize = resize;
......
...@@ -102,7 +102,7 @@ void modelDefaultEntries ( void ) ...@@ -102,7 +102,7 @@ void modelDefaultEntries ( void )
instID = institutInq( 0, 1, "NCEP", NULL); instID = institutInq( 0, 1, "NCEP", NULL);
resH[9] = modelDef(instID, 80, "T62L28MRF"); resH[9] = modelDef(instID, 80, "T62L28MRF");
for ( i = 0; i < 10 ; i++ ) for ( i = 0; i < 10 ; i++ )
reshSetStatus(resH[i], &modelOps, SUSPENDED); reshSetStatus(resH[i], &modelOps, SUSPENDED);
} }
...@@ -121,22 +121,22 @@ void modelInit(void) ...@@ -121,22 +121,22 @@ void modelInit(void)
char *env; char *env;
nspc = namespaceGetNumber (); nspc = namespaceGetNumber ();
if ( !modelInitialized ) if ( !modelInitialized )
{ {
modelInitialized = 1; modelInitialized = 1;
modelInitializedNsp = xcalloc ( 1, nspc * sizeof ( int )); modelInitializedNsp = (int*) xcalloc ( 1, nspc * sizeof ( int ));
atexit ( modelFinalize ); atexit ( modelFinalize );
env = getenv("MODEL_DEBUG"); env = getenv("MODEL_DEBUG");
if ( env ) MODEL_Debug = atoi(env); if ( env ) MODEL_Debug = atoi(env);
} }
nsp = namespaceGetActive (); nsp = namespaceGetActive ();
if ( modelInitializedNsp[nsp] ) return; if ( modelInitializedNsp[nsp] ) return;
modelInitializedNsp[nsp] = 1; modelInitializedNsp[nsp] = 1;
modelDefaultEntries (); modelDefaultEntries ();
} }
...@@ -154,8 +154,8 @@ struct modelLoc ...@@ -154,8 +154,8 @@ struct modelLoc
static enum cdiApplyRet static enum cdiApplyRet
findModelByID(int resID, void *res, void *data) findModelByID(int resID, void *res, void *data)
{ {
model_t *modelptr = res; model_t *modelptr = (model_t*) res;
struct modelLoc *ret = data; struct modelLoc *ret = (struct modelLoc*) data;
int instID = ret->instID, modelgribID = ret->modelgribID; int instID = ret->instID, modelgribID = ret->modelgribID;
if (modelptr->used if (modelptr->used
&& modelptr->instID == instID && modelptr->instID == instID
...@@ -171,8 +171,8 @@ findModelByID(int resID, void *res, void *data) ...@@ -171,8 +171,8 @@ findModelByID(int resID, void *res, void *data)
static enum cdiApplyRet static enum cdiApplyRet
findModelByName(int resID, void *res, void *data) findModelByName(int resID, void *res, void *data)
{ {
model_t *modelptr = res; model_t *modelptr = (model_t*) res;
struct modelLoc *ret = data; struct modelLoc *ret = (struct modelLoc*) data;
int instID = ret->instID, modelgribID = ret->modelgribID; int instID = ret->instID, modelgribID = ret->modelgribID;
const char *name = ret->name; const char *name = ret->name;
if (modelptr->used if (modelptr->used
...@@ -303,7 +303,7 @@ enum { ...@@ -303,7 +303,7 @@ enum {
static int modelGetSizeP(void * modelptr, void *context) static int modelGetSizeP(void * modelptr, void *context)
{ {
model_t *p = modelptr; model_t *p = (model_t*) modelptr;
int txsize = serializeGetSize(model_nints, DATATYPE_INT, context) int txsize = serializeGetSize(model_nints, DATATYPE_INT, context)
+ serializeGetSize(p->name?strlen(p->name) + 1:0, DATATYPE_TXT, context); + serializeGetSize(p->name?strlen(p->name) + 1:0, DATATYPE_TXT, context);
return txsize; return txsize;
...@@ -312,7 +312,7 @@ static int modelGetSizeP(void * modelptr, void *context) ...@@ -312,7 +312,7 @@ static int modelGetSizeP(void * modelptr, void *context)
static void modelPackP(void * modelptr, void * buf, int size, int *position, void *context) static void modelPackP(void * modelptr, void * buf, int size, int *position, void *context)
{ {
model_t *p = modelptr; model_t *p = (model_t*) modelptr;
int tempbuf[model_nints]; int tempbuf[model_nints];
tempbuf[0] = p->self; tempbuf[0] = p->self;
tempbuf[1] = p->instID; tempbuf[1] = p->instID;
...@@ -328,17 +328,14 @@ modelUnpack(void *buf, int size, int *position, int nspTarget, void *context) ...@@ -328,17 +328,14 @@ modelUnpack(void *buf, int size, int *position, int nspTarget, void *context)
{ {
int tempbuf[model_nints]; int tempbuf[model_nints];
int modelID; int modelID;
char *name; char *name = NULL;
serializeUnpack(buf, size, position, tempbuf, model_nints, DATATYPE_INT, context); serializeUnpack(buf, size, position, tempbuf, model_nints, DATATYPE_INT, context);
if (tempbuf[3] != 0) if (tempbuf[3] != 0)
{ {
name = xmalloc(tempbuf[3]); name = (char*) xmalloc(tempbuf[3]);
serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context); serializeUnpack(buf, size, position, name, tempbuf[3], DATATYPE_TXT, context);
} }
else
{
name = "";
}
modelID = modelDef( namespaceAdaptKey ( tempbuf[1], nspTarget ), tempbuf[2], name); modelID = modelDef( namespaceAdaptKey ( tempbuf[1], nspTarget ), tempbuf[2], name);
// FIXME: this should work, once all types are transferred // FIXME: this should work, once all types are transferred
//assert(modelID == tempbuf[0]); //assert(modelID == tempbuf[0]);
......
...@@ -202,8 +202,7 @@ namespaceNew() ...@@ -202,8 +202,7 @@ namespaceNew()
else if (namespacesSize == 1) else if (namespacesSize == 1)
{ {
/* make room for additional namespace */ /* make room for additional namespace */
struct namespace *newNameSpaces struct namespace *newNameSpaces = (struct namespace*) xmalloc((namespacesSize + 1) * sizeof (namespaces[0]));
= xmalloc((namespacesSize + 1) * sizeof (namespaces[0]));
memcpy(newNameSpaces, namespaces, sizeof (namespaces[0])); memcpy(newNameSpaces, namespaces, sizeof (namespaces[0]));
namespaces = newNameSpaces; namespaces = newNameSpaces;
++namespacesSize; ++namespacesSize;
...@@ -213,8 +212,7 @@ namespaceNew() ...@@ -213,8 +212,7 @@ namespaceNew()
{ {
/* make room for additional namespace */ /* make room for additional namespace */
newNamespaceID = namespacesSize; newNamespaceID = namespacesSize;
namespaces namespaces = (struct namespace*) xrealloc(namespaces, (namespacesSize + 1) * sizeof (namespaces[0]));
= xrealloc(namespaces, (namespacesSize + 1) * sizeof (namespaces[0]));
++namespacesSize; ++namespacesSize;
} }
else /* implicit: namespacesSize >= NUM_NAMESPACES */ else /* implicit: namespacesSize >= NUM_NAMESPACES */
......
...@@ -99,7 +99,7 @@ void pioInfoInit ( pioInfo_t * p ) ...@@ -99,7 +99,7 @@ void pioInfoInit ( pioInfo_t * p )
void commInit ( void ) void commInit ( void )
{ {
xassert ( info == 0 ); xassert ( info == 0 );
info = xmalloc ( sizeof ( pioInfo_t )); info = (pioInfo_t*) xmalloc ( sizeof ( pioInfo_t ));
pioInfoInit ( info ); pioInfoInit ( info );
} }
...@@ -384,7 +384,7 @@ void commDefCommNode ( void ) ...@@ -384,7 +384,7 @@ void commDefCommNode ( void )
size = info->sizePio; size = info->sizePio;
myHost = xmalloc(MPI_MAX_PROCESSOR_NAME); myHost = (char*) xmalloc(MPI_MAX_PROCESSOR_NAME);
{ {
int len; int len;
xmpi ( MPI_Get_processor_name ( myHost, &len )); xmpi ( MPI_Get_processor_name ( myHost, &len ));
...@@ -512,7 +512,7 @@ void commRecvNodeMap ( void ) ...@@ -512,7 +512,7 @@ void commRecvNodeMap ( void )
xdebug ( "info->nProcsColl=%d", info->nProcsColl ); xdebug ( "info->nProcsColl=%d", info->nProcsColl );
info->nodeMap = xmalloc ( info->nProcsColl * info->nodeMap = (int*) xmalloc ( info->nProcsColl *
sizeof ( info->nodeMap[0] )); sizeof ( info->nodeMap[0] ));
xmpi ( MPI_Recv ( info->nodeMap, info->nProcsColl, MPI_INTEGER, xmpi ( MPI_Recv ( info->nodeMap, info->nProcsColl, MPI_INTEGER,
...@@ -552,7 +552,7 @@ void commEvalPhysNodes ( void ) ...@@ -552,7 +552,7 @@ void commEvalPhysNodes ( void )
size = info->nProcsIO * sizeNodeInfo; size = info->nProcsIO * sizeNodeInfo;
nodeInfo = xmalloc ( size * sizeof ( int )); nodeInfo = (nodeInfo_t*) xmalloc ( size * sizeof ( int ));
if ( info->rankGlob == info->root ) if ( info->rankGlob == info->root )
{ {
...@@ -592,12 +592,12 @@ void commEvalPhysNodes ( void ) ...@@ -592,12 +592,12 @@ void commEvalPhysNodes ( void )
xassert ( info->nProcsColl <= info->nProcsModel ); xassert ( info->nProcsColl <= info->nProcsModel );
info->procsCollMap = xmalloc ( info->nProcsColl * info->procsCollMap = (int*) xmalloc ( info->nProcsColl *
sizeof ( info->procsCollMap[0] )); sizeof ( info->procsCollMap[0] ));
// define nodeSizes // define nodeSizes
info->nodeInfo.nNodes = nNodes; info->nodeInfo.nNodes = nNodes;
info->nodeSizes = xmalloc ( info->nodeInfo.nNodes * info->nodeSizes = (int*) xmalloc ( info->nodeInfo.nNodes *
sizeof ( info->nodeSizes[0] )); sizeof ( info->nodeSizes[0] ));
collID = 0; collID = 0;
for ( IOID = 0; IOID < info->nProcsIO; IOID++ ) for ( IOID = 0; IOID < info->nProcsIO; IOID++ )
...@@ -608,11 +608,11 @@ void commEvalPhysNodes ( void ) ...@@ -608,11 +608,11 @@ void commEvalPhysNodes ( void )
} }
// define nodeMap // define nodeMap
info->nodeMap = xmalloc ( info->nProcsColl * info->nodeMap = (int*) xmalloc ( info->nProcsColl *
sizeof ( info->nodeMap[0] )); sizeof ( info->nodeMap[0] ));
// helpers // helpers
p1 = xmalloc ( info->nodeInfo.nNodes * sizeof ( p1[0] )); p1 = (int**) xmalloc ( info->nodeInfo.nNodes * sizeof ( p1[0] ));
p2 = xmalloc ( info->nodeInfo.nNodes * sizeof ( p2[0] )); p2 = (int**) xmalloc ( info->nodeInfo.nNodes * sizeof ( p2[0] ));
idx = 0; idx = 0;
for ( i = 0; i < info->nodeInfo.nNodes; i++ ) for ( i = 0; i < info->nodeInfo.nNodes; i++ )
{ {
...@@ -694,7 +694,7 @@ void commDefCommsIO ( void ) ...@@ -694,7 +694,7 @@ void commDefCommsIO ( void )
info->nProcsModel != CDI_UNDEFID && info->nProcsModel != CDI_UNDEFID &&
info->commGlob != MPI_COMM_NULL ); info->commGlob != MPI_COMM_NULL );
info->commsIO = xmalloc ( info->nProcsColl * info->commsIO = (MPI_Comm*) xmalloc ( info->nProcsColl *
sizeof ( info->commsIO[0] )); sizeof ( info->commsIO[0] ));
for ( collID = 0; collID < info->nProcsColl; collID++ ) for ( collID = 0; collID < info->nProcsColl; collID++ )
info->commsIO[collID] = MPI_COMM_NULL; info->commsIO[collID] = MPI_COMM_NULL;
...@@ -702,7 +702,7 @@ void commDefCommsIO ( void ) ...@@ -702,7 +702,7 @@ void commDefCommsIO ( void )
strncpy ( name, "COMMSIO_", 8 ); strncpy ( name, "COMMSIO_", 8 );
name[MAXCOMMIONAME - 1] = '\0'; name[MAXCOMMIONAME - 1] = '\0';
ranks = xmalloc (( info->nProcsModel + 1 ) * sizeof ( ranks[0] )); ranks = (int*) xmalloc (( info->nProcsModel + 1 ) * sizeof ( ranks[0] ));
for ( i = 0; i < info->nProcsModel; i++ ) for ( i = 0; i < info->nProcsModel; i++ )
ranks[i] = i; ranks[i] = i;
......
...@@ -184,7 +184,7 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping, ...@@ -184,7 +184,7 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
weightsStreams[i] += * ( vSizes + offset++ ); weightsStreams[i] += * ( vSizes + offset++ );
} }