[cig-commits] r4813 - in long/3D/Gale/trunk/src/StGermain: . Base/Container/src Base/Container/tests Base/IO/src

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:45:45 PDT 2006


Author: walter
Date: 2006-10-11 13:45:44 -0700 (Wed, 11 Oct 2006)
New Revision: 4813

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTable.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTableIterator.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/Heap.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedList.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListIterator.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListNode.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/List.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/PtrMap.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/src/UIntMap.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testHashTable.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedList.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedListIterator.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMap.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMaxHeap.c
   long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testSet.c
   long/3D/Gale/trunk/src/StGermain/Base/IO/src/PathUtils.c
   long/3D/Gale/trunk/src/StGermain/Base/IO/src/StreamFormatter.c
Log:
 r2870 at earth:  boo | 2006-10-11 13:42:25 -0700
  r2786 at earth (orig r3774):  KathleenHumble | 2006-08-31 00:39:32 -0700
  changing all malloc, realloc, free and strdup
  in their StGermain equivalents.
  (For all execpt Base/Foundation and BTree which
  are use to define the StGermain memory usage / monitoring)
  
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2869
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3773
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2870
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3774

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTable.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTable.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTable.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -111,7 +111,7 @@
 	_Stg_Class_Init ((Stg_Class*) self);
 	
 	self->max = MAX_ENTRIES;
-	self->entries = (HashTable_Entry**) malloc( sizeof( HashTable_Entry* ) * (self->max+1) );
+	self->entries = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * (self->max+1) );
 	memset( self->entries, 0, sizeof( HashTable_Entry* ) * (self->max+1) );
 
 	/* Dictionary info */
@@ -176,13 +176,13 @@
 				}
 				
 				heTemp = he->next;
-				free( he ); /** Freeing the Entry without calling the Class_Delete function, because HashTable_Entry does not inherit __Class */
+				Memory_Free( he ); /** Freeing the Entry without calling the Class_Delete function, because HashTable_Entry does not inherit __Class */
 
 				he = heTemp;
 			}
 		}
 	}
-	free( self->entries );
+	Memory_Free( self->entries );
 	_Stg_Class_Delete( self );
 }
 
@@ -203,7 +203,7 @@
 	newTable->max = self->max;
 	newTable->keyType = self->keyType;
 
-	newTable->entries = (HashTable_Entry**) malloc( sizeof( HashTable_Entry* ) * (self->max+1) );
+	newTable->entries = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * (self->max+1) );
 	memset( newTable->entries, 0, sizeof( HashTable_Entry* ) * (self->max+1) );
 
 	for ( hi = HashTable_First( self ); hi; hi = HashTable_Next( hi ) ) {
@@ -408,7 +408,7 @@
     		}
 	}
 	
-	he = malloc( sizeof(HashTable_Entry) );
+	he = Memory_Alloc( HashTable_Entry , "HashTable_Entry");
 	memset( he, 0, sizeof( HashTable_Entry ) );
 	he->next = NULL;
 	he->hash = hash;
@@ -512,7 +512,7 @@
 			/* Leaving the data inside the entry */
 		}
 		
-		free( he );
+		Memory_Free( he );
 		return 1;
 	}
 
@@ -557,10 +557,9 @@
 	assert( ht );
 	
 	newMax = ht->max * 2 + 1;
-	newArray = (HashTable_Entry**) malloc( sizeof( HashTable_Entry* ) * newMax );
+	newArray = Memory_Alloc_Array_Unnamed(HashTable_Entry*, sizeof( HashTable_Entry* ) * newMax );
 	if( !newArray ){
-		fprintf( stderr, "out of memory..\n" );
-		assert( 0 );
+		Journal_Firewall(0, Journal_Register(ErrorStream_Type,"HashTable"), "Out of memory in '%s'\n", __func__ );
 	}
 	memset( newArray, 0, sizeof( HashTable_Entry* ) * newMax );
 	
@@ -604,4 +603,3 @@
     
 	return HashTable_Next( hi );
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTableIterator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTableIterator.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/HashTableIterator.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -51,19 +51,15 @@
 {
 	HashTableIterator *self = NULL;
 
-	/** HashTableIterator has to be malloced instead of using Class_New, because Class_New uses Memory_Alloc, 
-	 *  but the Memory module will not have been initialized at this stage */
+	/** using Class_New as Memory module has been initialized at this stage */
 	
-	self = (HashTableIterator*)malloc( _sizeOfSelf );
-	memset( self, 0, _sizeOfSelf );
+	self = (HashTableIterator*)_StG_Class_New(
+		_sizeOfSelf,
+		type,
+		_delete,
+		_print, 
+		_copy );
 	
-	self->_sizeOfSelf = _sizeOfSelf;
-	self->_deleteSelf = True;
-	self->type = type;
-	self->_delete = _delete;
-	self->_print = _print;
-	self->_copy = _copy;
-	
 	return self;
 }
 
@@ -97,8 +93,7 @@
 void _HashTableIterator_DeleteFunc( void *self )
 {
 	if( self ){
-		free( self );
-		/* freeing the Iterator instead of using class_delete, because it was initially malloced */
+		_Stg_Class_Delete( self );
 	}
 }
 
@@ -152,4 +147,3 @@
 
 	return NULL;
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/Heap.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/Heap.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/Heap.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -141,7 +141,7 @@
 
 	assert( self );
 
-	free( self->keys );
+	Memory_Free( self->keys );
 	_Stg_Class_Delete( self );
 }
 	
@@ -177,4 +177,3 @@
 {
 	return 2*i+1;
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedList.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedList.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedList.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -157,9 +157,9 @@
 			self->dataDeleteFunction( curr->data );
 		}
 		else{
-			free (curr->data);
+			Memory_Free(curr->data);
 		}
-		free( curr ); /** Freeing the Node without calling the Stg_Class_Delete function, because LinkedList_Node does not inherit __Stg_Class */
+		Memory_Free( curr ); /** Freeing the Node without calling the Stg_Class_Delete function, because LinkedList_Node does not inherit __Stg_Class */
 		
 		curr = temp;
 		--self->nodeCount;
@@ -273,7 +273,7 @@
 			list->dataDeleteFunction(targetNode->data);
 		}
 		else{
-			free (targetNode->data);
+			Memory_Free(targetNode->data);
 		}
 
 		if(prev == NULL){
@@ -283,7 +283,7 @@
 			prev->next = targetNode->next;
 		}
 		
-		free(targetNode);
+		Memory_Free(targetNode);
 		--list->nodeCount;
 		return 1;
 	}
@@ -316,7 +316,7 @@
 
 	assert( list );
 	
-	array = (char*)malloc( list->nodeCount * dataSize );
+	array = Memory_Alloc_Array_Unnamed(char, list->nodeCount * dataSize );
 	assert( array );
 	
 	curr = list->head;
@@ -388,4 +388,3 @@
 	}
 	return NULL;
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListIterator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListIterator.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListIterator.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -52,19 +52,15 @@
 {
 	LinkedListIterator *self = NULL;
 
-	/** LinkedListIterator has to be malloced instead of using Class_New, because Class_New uses Memory_Alloc, 
-	 *  but the Memory module will not have been initialized at this stage */
+	/** LinkedListIterator using Class_New, because  Memory module has been initialized */
 	
-	self = (LinkedListIterator*)malloc( _sizeOfSelf );
-	memset( self, 0, _sizeOfSelf );
+	self = (LinkedListIterator*)_Stg_Class_New(
+		_sizeOfSelf,
+		type,
+		_delete,
+		_print, 
+		_copy );
 	
-	self->_sizeOfSelf = _sizeOfSelf;
-	self->_deleteSelf = True;
-	self->type = type;
-	self->_delete = _delete;
-	self->_print = _print;
-	self->_copy = _copy;
-	
 	return self;
 }
 
@@ -99,8 +95,7 @@
 void _LinkedListIterator_DeleteFunc( void *self )
 {
 	if( self ){
-		free( self );
-		/* freeing the Iterator instead of using class_delete, because it was initially malloced */
+		_Stg_Class_Delete( self );
 	}
 }
 
@@ -118,4 +113,3 @@
 	Journal_Printf( myStream, "LinkedListIterator (ptr): (%p)\n", iterator );
 	Journal_Printf( myStream, "\tlist (ptr): (%p)\n", iterator->list );
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListNode.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListNode.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/LinkedListNode.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -46,10 +46,10 @@
 	LinkedListNode* self;
 	
 	/* Allocate memory */
-	self = ( LinkedListNode* ) malloc ( sizeof( LinkedListNode ) );
+	self = Memory_Alloc( LinkedListNode, "LinkedListNode" );
 	memset ( self, 0, sizeof ( LinkedListNode ) );
 
-	assert ( self );
+	assert( self );
 	/* General info */
 	
 	/* Virtual functions */
@@ -67,8 +67,7 @@
 	/* Virtual info */
 	
 	/* ListNode info */
-	assert ( self );
+		assert( self );
 	self->data = NULL;
 	self->sizeOfData = 0;
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/List.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/List.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/List.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -136,8 +136,8 @@
 	self->elementSize = elementSize;
 	self->delta = delta;
 	self->maxElements = self->delta;
-	self->elements = malloc( self->elementSize * self->maxElements );
-	assert( self->elements ); /* TODO change this to a firewall, or something */
+	self->elements = Memory_Alloc_Bytes_Unnamed( self->elementSize * self->maxElements, char);
+	assert( self->elements ); 
 	self->elementCnt = 0;
 }
 
@@ -151,7 +151,7 @@
 	
 	/* Stg_Class_Delete the class itself */
 	if( self->elements )
-		free( self->elements );
+		Memory_Free( self->elements );
 	
 	/* Stg_Class_Delete parent */
 	_Stg_Class_Delete( self );
@@ -215,16 +215,16 @@
 		factor = ceil( (float)(size - self->maxElements) / (float)self->delta );
 		self->maxElements += factor * self->delta;
 		
-		newElements = malloc( self->elementSize * self->maxElements );
-		assert( newElements ); /* TODO change this */
+		newElements = Memory_Alloc_Bytes_Unnamed( self->elementSize * self->maxElements, char );
+		assert( newElements ); 
 		if( self->elements ) {
 			memcpy( newElements, self->elements, self->elementSize * self->elementCnt );
-			free( self->elements );
+			Memory_Free( self->elements );
 		}
 		self->elements = newElements;
 	}
 	else if( size < self->elementCnt ) {
-		assert( 0 ); /* TODO */
+		Journal_Firewall( 0, Journal_Register( ErrorStream_Type, "List" ), "error in '%s'\n", __func__); 
 	}
 	
 	self->elementCnt = size;
@@ -234,4 +234,3 @@
 /*----------------------------------------------------------------------------------------------------------------------------------
 ** Private Functions
 */
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/PtrMap.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/PtrMap.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/PtrMap.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -125,8 +125,9 @@
 	
 	self->delta = delta;
 	self->maxTuples = self->delta;
-	self->tupleTbl = malloc( sizeof(PtrMapTuple) * self->maxTuples );
+	self->tupleTbl = Memory_Alloc_Array_Unnamed( PtrMapTuple, self->maxTuples );
 	assert( self->tupleTbl ); /* TODO change this to a firewall, or something */
+
 	self->tupleCnt = 0;
 }
 
@@ -142,7 +143,7 @@
 	assert( self );
 	
 	if( self->tupleTbl )
-		free( self->tupleTbl );
+		Memory_Free( self->tupleTbl );
 	
 	/* Stg_Class_Delete parent */
 	_Stg_Class_Delete( self );
@@ -191,11 +192,11 @@
 		factor = ceil( (float)(newTupleCnt - self->maxTuples) / (float)self->delta );
 		self->maxTuples += factor * self->delta;
 		
-		newTuples = malloc( sizeof(PtrMapTuple) * self->maxTuples );
+		newTuples = Memory_Alloc_Array_Unnamed( PtrMapTuple, self->maxTuples );
 		assert( newTuples ); /* TODO change this */
 		if( self->tupleTbl ) {
 			memcpy( newTuples, self->tupleTbl, sizeof(PtrMapTuple) * self->tupleCnt );
-			free( self->tupleTbl );
+			Memory_Free( self->tupleTbl );
 		}
 		self->tupleTbl = newTuples;
 	}
@@ -226,4 +227,3 @@
 /*----------------------------------------------------------------------------------------------------------------------------------
 ** Private Functions
 */
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/src/UIntMap.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/src/UIntMap.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/src/UIntMap.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -189,11 +189,11 @@
 }
 
 void UIntMap_DataCopy( void** dstData, void* data, SizeT size ) {
-	*dstData = malloc( 2 * sizeof(unsigned) );
+	*dstData = Memory_Alloc_Array_Unnamed( unsigned, 2 );
 	((unsigned*)(*dstData))[0] = ((unsigned*)data)[0];
 	((unsigned*)(*dstData))[1] = ((unsigned*)data)[1];
 }
 
 void UIntMap_DataDelete( void* data ) {
-	free( data );
+	Memory_Free( data );
 }

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testHashTable.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testHashTable.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testHashTable.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -41,7 +41,7 @@
 void deleteFunction( void *data ){
 	assert( data );
 
-	free( data );
+	Memory_Free( data );
 }
 
 void printFunction( void *data, void *stream ){
@@ -210,4 +210,3 @@
 	
 	return 0; /* success */
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedList.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedList.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedList.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -75,7 +75,7 @@
 
 void dataCopyFunction( void **nodeData, void *newData, SizeT dataSize)
 {
-	*nodeData = malloc(dataSize);
+	*nodeData = Memory_Alloc_Bytes_Unnamed(dataSize, char);
 	memset(*nodeData, 0, dataSize);
 
 	memcpy(*nodeData, newData, dataSize);
@@ -125,7 +125,7 @@
 		Journal_Printf( myStream, "Inserting data into the List\n");
 		
 		for(i=0; i<NUM_DATA; i++){
-			array[i] = malloc(sizeof(int));
+			array[i] = Memory_Alloc(int, "TestLinkedList_ArrayEntry");
 			randomNum = rand();
 			randomMax = RAND_MAX;
 			*array[i] = NUM_DATA - i;
@@ -176,4 +176,3 @@
 	
 	return 0; /* success */
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedListIterator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedListIterator.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testLinkedListIterator.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -74,7 +74,7 @@
 
 void dataCopyFunction( void **nodeData, void *newData, SizeT dataSize)
 {
-	*nodeData = malloc(dataSize);
+	*nodeData = Memory_Alloc_Bytes_Unnamed(dataSize, char);
 	memset(*nodeData, 0, dataSize);
 
 	memcpy(*nodeData, newData, dataSize);
@@ -129,7 +129,7 @@
 		Journal_Printf( myStream, "Inserting data into the List\n");
 		
 		for(i=0; i<NUM_DATA; i++){
-			array[i] = malloc(sizeof(int));
+			array[i] = Memory_Alloc(int, "testLinkedListIterator_ArrayEntry");
 			randomNum = rand();
 			randomMax = RAND_MAX;
 			*array[i] = NUM_DATA - i;
@@ -151,7 +151,8 @@
 
 	Journal_Printf( myStream, "\nDeleting the List\n" );
 	Stg_Class_Delete( (void*)numList );
-	
+	//Adding because it seems missing ,though probably isn't
+	Memory_Free(array);
 	BaseContainer_Finalise();
 	BaseIO_Finalise();
 	BaseFoundation_Finalise();
@@ -161,4 +162,3 @@
 	
 	return 0; /* success */
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMap.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMap.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMap.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -45,14 +45,14 @@
 
 
 void mapCopyFunc( void** newData, void* data, SizeT size ) {
-	*newData = malloc( size );
+	*newData = Memory_Alloc_Bytes_Unnamed( size , char);
 	/* TODO: convert to journal */
 	assert( *newData );
 
-	(*(MapTuple**)newData)->keyData = malloc( strlen( ((MapTuple*)data)->keyData ) + 1 );
+	(*(MapTuple**)newData)->keyData = Memory_Alloc_Bytes_Unnamed( strlen( ((MapTuple*)data)->keyData ) + 1 , char);
 	strcpy( (*(MapTuple**)newData)->keyData, ((MapTuple*)data)->keyData );
 
-	(*(MapTuple**)newData)->valueData = malloc( sizeof(int) );
+	(*(MapTuple**)newData)->valueData = Memory_Alloc( int, "MapTuple_newData->valueData" );
 	*(int*)(*(MapTuple**)newData)->valueData = *(int*)((MapTuple*)data)->valueData;
 }
 
@@ -60,9 +60,9 @@
 void mapDeleteFunc( void* data ) {
 	/* TODO: convert to journal */
 	assert( data );
-	free( ((MapTuple*)data)->keyData );
-	free( ((MapTuple*)data)->valueData );
-	free( data );
+	Memory_Free( ((MapTuple*)data)->keyData );
+	Memory_Free( ((MapTuple*)data)->valueData );
+	Memory_Free( data );
 }
 
 

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMaxHeap.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMaxHeap.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testMaxHeap.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -70,9 +70,10 @@
 void** extendArray( int newCount, void ***array )
 {
 	assert( array );
+	//TODO Check if this is executed by creating memory
 	if( (*(int***)array = (int**)realloc(*array, newCount * sizeof( int* ))) == NULL ){
-		fprintf( stderr, "Memory allocation failed..!!\n Aborting..!!\n" );
-		assert( 0 );
+		Journal_Firewall( 0, Journal_Register(ErrorStream_Type, "testMaxHeap"), "Memory allocation failed in '%s'!!\n Aborting..!!\n", __func__ );
+	
 	}
 	else{
 		return *array;
@@ -122,8 +123,8 @@
 	if( rank == procToWatch ) {
 		
 		myStream = Journal_Register( InfoStream_Type, "LinkedListStream" );
-		data = malloc( sizeof(int) * NUM_DATA );
-		keys = malloc( sizeof(int*) * NUM_INITIAL_DATA );
+		data = Memory_Alloc_Array_Unnamed( int, NUM_DATA );
+		keys = Memory_Alloc_Array_Unnamed( int*, NUM_INITIAL_DATA );
 		
 		Journal_Printf( myStream, "\nCreating the Heap\n" );
 		for(i=0; i<NUM_INITIAL_DATA; i++){
@@ -161,7 +162,7 @@
 		Journal_Printf( myStream, "\nDeleting the Heap\n" );
 		Stg_Class_Delete( (void*)heap );
 		
-		free( data );
+		Memory_Free( data );
 	}
 	
 	BaseContainer_Finalise();
@@ -173,4 +174,3 @@
 	
 	return 0; /* success */
 }
-

Modified: long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testSet.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testSet.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/Container/tests/testSet.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -53,7 +53,7 @@
 
 
 void copyFunc( void** newData, void* data, SizeT size ) {
-	*newData = malloc( size );
+	*newData = Memory_Alloc_Bytes_Unnamed( size, char );
 	/* TODO: convert to journal */
 	assert( *newData );
 
@@ -64,7 +64,7 @@
 void deleteFunc( void* data ) {
 	/* TODO: convert to journal */
 	assert( data );
-	free( data );
+	Memory_Free( data );
 }
 
 

Modified: long/3D/Gale/trunk/src/StGermain/Base/IO/src/PathUtils.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/IO/src/PathUtils.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/IO/src/PathUtils.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -33,7 +33,7 @@
 	fullPath[0] = 0;
 	
 	if( searchPaths && !(filename[0] == '/' || filename[0] == '~') ) {
-		spaths = (char*)malloc( sizeof(char) * (strlen( searchPaths ) + 1) );
+		spaths = Memory_Alloc_Array_Unnamed(char,(strlen( searchPaths ) + 1));
 		strcpy( spaths, searchPaths );
 		pos = strtok( spaths, ":" );
 		while( pos ) {
@@ -49,7 +49,7 @@
 			pos = strtok( NULL, ":" );
 		}
 		
-		free( spaths );
+		Memory_Free( spaths );
 	}
 	else {
 		f = fopen( filename, "r" );

Modified: long/3D/Gale/trunk/src/StGermain/Base/IO/src/StreamFormatter.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/IO/src/StreamFormatter.c	2006-10-11 20:45:42 UTC (rev 4812)
+++ long/3D/Gale/trunk/src/StGermain/Base/IO/src/StreamFormatter.c	2006-10-11 20:45:44 UTC (rev 4813)
@@ -124,7 +124,7 @@
 StreamFormatter_Buffer* stgStreamFormatter_Buffer;
 
 StreamFormatter_Buffer* StreamFormatter_Buffer_New() {
-	StreamFormatter_Buffer* result = (StreamFormatter_Buffer*)malloc( sizeof(StreamFormatter_Buffer) );
+	StreamFormatter_Buffer* result = Memory_Alloc( StreamFormatter_Buffer, "StreamFormatter_Buffer" );
 	result->buffer1 = NULL;
 	result->buffer2 = NULL;
 	result->length1 = 0;
@@ -136,13 +136,13 @@
 }
 void StreamFormatter_Buffer_Delete( StreamFormatter_Buffer* buffer ) {
 	if ( buffer->buffer1 != NULL ) {
-		free( buffer->buffer1 );
+		Memory_Free( buffer->buffer1 );
 	}
 	if ( buffer->buffer2 != NULL ) {
-		free( buffer->buffer2 );
+		Memory_Free( buffer->buffer2 );
 	}
 
-	free( buffer );
+	Memory_Free( buffer );
 }
 char* StreamFormatter_Buffer_AllocNext( Index size ) {
 
@@ -159,11 +159,8 @@
 	/* Realloc/alloc as needed */
 	if ( size > *stgStreamFormatter_Buffer->lengthPtr ) {
 		*stgStreamFormatter_Buffer->lengthPtr = size;
-		*stgStreamFormatter_Buffer->current = (char*)realloc( *stgStreamFormatter_Buffer->current, size );
+		*stgStreamFormatter_Buffer->current = (char*)Memory_Realloc( *stgStreamFormatter_Buffer->current, size );
 	}
 
 	return *stgStreamFormatter_Buffer->current;
 }
-
-
-



More information about the cig-commits mailing list