Commit e8ee384e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

replace free() by Free()

parent 4dbb68f2
......@@ -7159,7 +7159,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
pbuf[3*i+2] = dest[2*nelem+i];
}
memcpy(dest, pbuf, tmpLen);
free(pbuf);
Free(pbuf);
}
#endif
......
......@@ -255,11 +255,6 @@
# endif
#endif
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
......
......@@ -37,7 +37,7 @@ typedef struct
size_t nobj;
int mtype;
int line;
char file[MEM_MAXNAME];
char filename[MEM_MAXNAME];
char functionname[MEM_MAXNAME];
}
MemTable_t;
......@@ -54,6 +54,17 @@ static size_t MaxMemUsed = 0;
static int MEM_Debug = 0; /* If set to 1, debugging */
static int MEM_Info = 0; /* If set to 1, print mem table at exit */
static
const char *get_filename(const char *file)
{
char *fnptr = strrchr(file, '/');
if ( fnptr ) fnptr++;
else fnptr = (char *) file;
return fnptr;
}
void memDebug(int debug)
{
MEM_Debug = debug;
......@@ -81,7 +92,7 @@ void memError(const char *functionname, const char *file, int line, size_t size)
{
printf("\n");
fprintf(stderr, "Error (%s) : Allocation of %zu bytes failed. [ line %d file %s ]\n",
functionname, size, line, file);
functionname, size, line, get_filename(file));
if ( errno ) perror("System error message ");
......@@ -100,7 +111,7 @@ void memListPrintEntry(int mtype, int item, size_t size, void *ptr,
if ( file != NULL )
{
fprintf(stderr, " line %4d", line);
fprintf(stderr, " file %s", file);
fprintf(stderr, " file %s", get_filename(file));
}
if ( functionname != NULL )
fprintf(stderr, " (%s)", functionname);
......@@ -118,7 +129,7 @@ void memListPrintTable(void)
memListPrintEntry(memTable[memID].mtype, memTable[memID].item,
memTable[memID].size*memTable[memID].nobj,
memTable[memID].ptr, memTable[memID].functionname,
memTable[memID].file, memTable[memID].line);
memTable[memID].filename, memTable[memID].line);
}
if ( MemObjs )
......@@ -271,15 +282,16 @@ int memListNewEntry(int mtype, void *ptr, size_t size, size_t nobj,
if ( file )
{
size_t len = strlen(file);
const char *filename = get_filename(file);
size_t len = strlen(filename);
if ( len > MEM_MAXNAME-1 ) len = MEM_MAXNAME-1;
(void) memcpy(memTable[memID].file, file, len);
memTable[memID].file[len] = '\0';
(void) memcpy(memTable[memID].filename, filename, len);
memTable[memID].filename[len] = '\0';
}
else
{
(void) strcpy(memTable[memID].file, "unknown");
(void) strcpy(memTable[memID].filename, "unknown");
}
if ( functionname )
......@@ -336,15 +348,16 @@ int memListChangeEntry(void *ptrold, void *ptr, size_t size,
if ( file )
{
size_t len = strlen(file);
const char *filename = get_filename(file);
size_t len = strlen(filename);
if ( len > MEM_MAXNAME-1 ) len = MEM_MAXNAME-1;
(void) memcpy(memTable[memID].file, file, len);
memTable[memID].file[len] = '\0';
(void) memcpy(memTable[memID].filename, filename, len);
memTable[memID].filename[len] = '\0';
}
else
{
(void) strcpy(memTable[memID].file, "unknown");
(void) strcpy(memTable[memID].filename, "unknown");
}
if ( functionname )
......@@ -458,7 +471,7 @@ void *memRealloc(void *ptrold, size_t size, const char *file, const char *functi
memError(functionname, file, line, size);
}
else
fprintf(stderr, "Warning (%s) : Allocation of 0 bytes! [ line %d file %s ]\n", functionname, line, file);
fprintf(stderr, "Warning (%s) : Allocation of 0 bytes! [ line %d file %s ]\n", functionname, line, get_filename(file));
return ptr;
}
......@@ -481,7 +494,7 @@ void memFree(void *ptr, const char *file, const char *functionname, int line)
{
if ( ptr && MEM_Debug )
fprintf(stderr, "%s info: memory entry at %p not found. [line %4d file %s (%s)]\n",
__func__, ptr, line, file, functionname);
__func__, ptr, line, get_filename(file), functionname);
}
}
......
......@@ -504,7 +504,7 @@ void gridDestroyKernel( grid_t * gridptr )
if ( gridptr->rowlon ) Free(gridptr->rowlon);
if ( gridptr->reference ) Free(gridptr->reference);
free ( gridptr );
Free( gridptr );
reshRemove ( id, &gridOps );
}
......
......@@ -108,15 +108,15 @@ void commDestroy ( void )
xassert ( info != NULL );
if ( info->nodeMap != NULL ) free ( info->nodeMap );
if ( info->nodeSizes != NULL ) free ( info->nodeSizes );
if ( info->nodeMap != NULL ) Free( info->nodeMap );
if ( info->nodeSizes != NULL ) Free( info->nodeSizes );
if ( info->commsIO != NULL )
{
for ( collID = 0; collID < info->nProcsColl; collID++ )
if ( info->commsIO[collID] != MPI_COMM_NULL )
xmpi(MPI_Comm_free(info->commsIO + collID));
free ( info->commsIO );
Free( info->commsIO );
info->commsIO = NULL;
}
......@@ -140,7 +140,7 @@ void commDestroy ( void )
info->commPio = MPI_COMM_NULL;
}
free ( info );
Free( info );
info = NULL;
}
......@@ -633,9 +633,9 @@ void commEvalPhysNodes ( void )
for ( IOID = info->nProcsModel; IOID < info->sizeGlob; IOID++ )
xmpi ( MPI_Send ( info->nodeMap, info->nProcsColl, MPI_INTEGER,
IOID, NODEMAP, info->commGlob ));
free ( p2 );
free ( p1 );
free ( nodeInfo );
Free( p2 );
Free( p1 );
Free( nodeInfo );
}
......@@ -735,7 +735,7 @@ void commDefCommsIO ( void )
}
xmpi ( MPI_Group_free ( &groupGlob ));
free ( ranks );
Free( ranks );
commPrint ( stdout );
}
......
......@@ -110,8 +110,8 @@ void dbuffer_cleanup ( struct dBuffer **dbuffer )
db = *dbuffer;
free ( db->buffer );
free ( db );
Free( db->buffer );
Free( db );
return;
}
......
......@@ -186,7 +186,7 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
w[j] = ( double ) * ( nodeSizes + j ) / ( double ) nPEs;
mapProblems(weightsStreams, streamMapping, (int)nStreams, nNodes, w);
free ( w );
Free( w );
for ( i = 0; i < nNodes; i++ )
{
......@@ -228,9 +228,9 @@ varMapGen(int *vSizes, int *sSizes, int *varMapping,
summandRank += * ( nodeSizes + i );
free ( w );
free ( varMappingNode );
free ( weightsVarsNode );
Free( w );
Free( varMappingNode );
Free( weightsVarsNode );
}
if ( ddebug )
......@@ -300,11 +300,11 @@ varsMapNDeco(int nNodes, int *nodeSizes)
"PE%d collects no data",
commCollID2RankGlob(j));
if ( varMapping ) free ( varMapping );
if ( varSizes ) free ( varSizes );
if ( collectsData ) free ( collectsData );
if ( streamSizes ) free ( streamSizes );
if ( resHs ) free ( resHs );
if ( varMapping ) Free( varMapping );
if ( varSizes ) Free( varSizes );
if ( collectsData ) Free( collectsData );
if ( streamSizes ) Free( streamSizes );
if ( resHs ) Free( resHs );
xdebug("%s", "RETURN");
}
......@@ -414,7 +414,7 @@ modelWinDefBufferSizes(void)
sumWinBufferSize += (size_t)txWin[collID].size;
}
Free(collIndex);
free ( streamIndexList );
Free( streamIndexList );
xdebug("sumWinBufferSize=%zu, MAXWINBUFFERSIZE=%zu", sumWinBufferSize,
(size_t)MAXWINBUFFERSIZE);
......
......@@ -55,12 +55,12 @@ listSetDelete(listSet *q)
{
succ = curr->next;
( *( q->valDestroy )) ( curr->val );
free ( curr );
Free( curr );
curr = succ;
}
}
free ( q );
Free( q );
return;
}
......
......@@ -101,7 +101,7 @@ destroyAFiledataMPINONB(void *v)
dbuffer_cleanup ( & ( of->db1 ));
dbuffer_cleanup ( & ( of->db2 ));
free ( of );
Free( of );
xdebug ( "IOPE%d: closed file, cleaned up, return",
rankNode );
......
......@@ -142,7 +142,7 @@ destroyBFiledataPF(void *v)
int iret = 0;
bFiledataPF *bfd = (bFiledataPF * ) v;
free ( bfd );
Free( bfd );
return iret;
}
......
......@@ -203,7 +203,7 @@ pioWriterStdIO(void)
writeP(bfd, amount);
free ( messageBuffer );
Free( messageBuffer );
break;
......
......@@ -132,7 +132,7 @@ collDefBufferSizes()
+ (2 * CDI_MAX_NAME + sizeof (taxis_t));
rxWin[root].dictSize += numRPCFuncs;
}
free ( streamIndexList );
Free( streamIndexList );
for ( modelID = 0; modelID < nProcsModel; modelID++ )
{
......
......@@ -126,7 +126,7 @@ void pcdiDebugComm ( const char *filename, const char *functionname, int line, M
"pe%d in %s, %s, line %d: comm: name=%s, size=%d, rank=%d\n",
rankGlob, functionname, filename, line,
name, size, rank );
free ( name );
Free( name );
}
......
......@@ -1028,9 +1028,9 @@ void streamClose(int streamID)
for ( index = 0; index < streamptr->ntsteps; ++index )
{
if ( streamptr->tsteps[index].records )
free(streamptr->tsteps[index].records);
Free(streamptr->tsteps[index].records);
if ( streamptr->tsteps[index].recIDs )
free(streamptr->tsteps[index].recIDs);
Free(streamptr->tsteps[index].recIDs);
taxisDestroyKernel(&streamptr->tsteps[index].taxis);
}
......@@ -1069,7 +1069,7 @@ static void stream_delete_entry(stream_t *streamptr)
xassert ( streamptr );
idx = streamptr->self;
free ( streamptr );
Free( streamptr );
reshRemove ( idx, &streamOps );
if ( CDI_Debug )
......
......@@ -440,8 +440,8 @@ void cdi_create_records(stream_t *streamptr, int tsID)
unsigned nrecords, maxrecords;
record_t *records;
tsteps_t* sourceTstep = streamptr->tsteps;
tsteps_t* destTstep = sourceTstep + tsID;
tsteps_t *sourceTstep = streamptr->tsteps;
tsteps_t *destTstep = sourceTstep + tsID;
if ( destTstep->records ) return;
......@@ -483,7 +483,7 @@ void cdi_create_records(stream_t *streamptr, int tsID)
// printf("tsID, nrecords %d %d\n", tsID, nrecords);
if ( maxrecords > 0 )
records = (record_t *) Malloc(maxrecords * sizeof(record_t));
records = (record_t *) Malloc(maxrecords*sizeof(record_t));
else
records = NULL;
......@@ -502,7 +502,7 @@ void cdi_create_records(stream_t *streamptr, int tsID)
for ( unsigned recID = 0; recID < maxrecords; recID++ )
{
record_t* curRecord = &sourceTstep->records[recID];
record_t *curRecord = &sourceTstep->records[recID];
destTstep->records[recID].used = curRecord->used;
if ( curRecord->used != CDI_UNDEFID && curRecord->varID != -1 ) /* curRecord->varID = -1 for write mode !!! */
{
......
......@@ -1247,7 +1247,7 @@ void varDefOptGribInt(int varID, int tile_index, long lval, const char *keyword)
else
{
if (vartable[varID].opt_grib_kvpair[idx].keyword)
free (vartable[varID].opt_grib_kvpair[idx].keyword);
Free(vartable[varID].opt_grib_kvpair[idx].keyword);
}
vartable[varID].opt_grib_kvpair[idx].data_type = t_int;
vartable[varID].opt_grib_kvpair[idx].int_val = (int) lval;
......@@ -1278,7 +1278,7 @@ void varDefOptGribDbl(int varID, int tile_index, double dval, const char *keywor
else
{
if (vartable[varID].opt_grib_kvpair[idx].keyword)
free (vartable[varID].opt_grib_kvpair[idx].keyword);
Free(vartable[varID].opt_grib_kvpair[idx].keyword);
}
vartable[varID].opt_grib_kvpair[idx].data_type = t_double;
vartable[varID].opt_grib_kvpair[idx].dbl_val = (int) dval;
......
......@@ -302,13 +302,13 @@ static void zaxisDestroyKernel( zaxis_t * zaxisptr )
int id = zaxisptr->self;
if ( zaxisptr->vals ) free ( zaxisptr->vals );
if ( zaxisptr->lbounds ) free ( zaxisptr->lbounds );
if ( zaxisptr->ubounds ) free ( zaxisptr->ubounds );
if ( zaxisptr->weights ) free ( zaxisptr->weights );
if ( zaxisptr->vct ) free ( zaxisptr->vct );
if ( zaxisptr->vals ) Free( zaxisptr->vals );
if ( zaxisptr->lbounds ) Free( zaxisptr->lbounds );
if ( zaxisptr->ubounds ) Free( zaxisptr->ubounds );
if ( zaxisptr->weights ) Free( zaxisptr->weights );
if ( zaxisptr->vct ) Free( zaxisptr->vct );
free ( zaxisptr );
Free( zaxisptr );
reshRemove ( id, &zaxisOps );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment