summaryrefslogtreecommitdiffstats
path: root/src/misc
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-01-10 08:01:00 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2007-01-10 08:01:00 -0800
commit8dfe404863427d5e7b18d055ffd78b453835f959 (patch)
treef0efcc544e0501aa6477948744e4d2788a4fb965 /src/misc
parentbe6a484a997a8477d4c3b03c17f798c1b0061bf1 (diff)
downloadabc-8dfe404863427d5e7b18d055ffd78b453835f959.tar.gz
abc-8dfe404863427d5e7b18d055ffd78b453835f959.tar.bz2
abc-8dfe404863427d5e7b18d055ffd78b453835f959.zip
Version abc70110
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/extra/extra.h9
-rw-r--r--src/misc/extra/extraUtilFile.c19
-rw-r--r--src/misc/extra/extraUtilMemory.c60
-rw-r--r--src/misc/mvc/mvcMan.c8
-rw-r--r--src/misc/nm/nmApi.c2
-rw-r--r--src/misc/st/stmm.c4
-rw-r--r--src/misc/vec/vecAtt.h19
-rw-r--r--src/misc/vec/vecFlt.h1
-rw-r--r--src/misc/vec/vecInt.h1
-rw-r--r--src/misc/vec/vecPtr.h1
-rw-r--r--src/misc/vec/vecStr.h1
-rw-r--r--src/misc/vec/vecVec.h1
12 files changed, 70 insertions, 56 deletions
diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h
index 585a5561..45686afb 100644
--- a/src/misc/extra/extra.h
+++ b/src/misc/extra/extra.h
@@ -291,7 +291,7 @@ extern int Extra_BitMatrixIsClique( Extra_BitMat_t * p );
/*=== extraUtilFile.c ========================================================*/
extern char * Extra_FileGetSimilarName( char * pFileNameWrong, char * pS1, char * pS2, char * pS3, char * pS4, char * pS5 );
-extern int Extra_FileNameCheckExtension( char * FileName, char * Extension );
+extern char * Extra_FileNameExtension( char * FileName );
extern char * Extra_FileNameAppend( char * pBase, char * pSuffix );
extern char * Extra_FileNameGeneric( char * FileName );
extern int Extra_FileSize( char * pFileName );
@@ -325,19 +325,20 @@ typedef struct Extra_MmStep_t_ Extra_MmStep_t;
// fixed-size-block memory manager
extern Extra_MmFixed_t * Extra_MmFixedStart( int nEntrySize );
-extern void Extra_MmFixedStop( Extra_MmFixed_t * p, int fVerbose );
+extern void Extra_MmFixedStop( Extra_MmFixed_t * p );
extern char * Extra_MmFixedEntryFetch( Extra_MmFixed_t * p );
extern void Extra_MmFixedEntryRecycle( Extra_MmFixed_t * p, char * pEntry );
extern void Extra_MmFixedRestart( Extra_MmFixed_t * p );
extern int Extra_MmFixedReadMemUsage( Extra_MmFixed_t * p );
// flexible-size-block memory manager
extern Extra_MmFlex_t * Extra_MmFlexStart();
-extern void Extra_MmFlexStop( Extra_MmFlex_t * p, int fVerbose );
+extern void Extra_MmFlexStop( Extra_MmFlex_t * p );
+extern void Extra_MmFlexPrint( Extra_MmFlex_t * p );
extern char * Extra_MmFlexEntryFetch( Extra_MmFlex_t * p, int nBytes );
extern int Extra_MmFlexReadMemUsage( Extra_MmFlex_t * p );
// hierarchical memory manager
extern Extra_MmStep_t * Extra_MmStepStart( int nSteps );
-extern void Extra_MmStepStop( Extra_MmStep_t * p, int fVerbose );
+extern void Extra_MmStepStop( Extra_MmStep_t * p );
extern char * Extra_MmStepEntryFetch( Extra_MmStep_t * p, int nBytes );
extern void Extra_MmStepEntryRecycle( Extra_MmStep_t * p, char * pEntry, int nBytes );
extern int Extra_MmStepReadMemUsage( Extra_MmStep_t * p );
diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c
index 9a47750f..14c987e8 100644
--- a/src/misc/extra/extraUtilFile.c
+++ b/src/misc/extra/extraUtilFile.c
@@ -110,7 +110,7 @@ char * Extra_FileGetSimilarName( char * pFileNameWrong, char * pS1, char * pS2,
/**Function*************************************************************
- Synopsis []
+ Synopsis [Returns the pointer to the file extension.]
Description []
@@ -119,21 +119,14 @@ char * Extra_FileGetSimilarName( char * pFileNameWrong, char * pS1, char * pS2,
SeeAlso []
***********************************************************************/
-int Extra_FileNameCheckExtension( char * FileName, char * Extension )
+char * Extra_FileNameExtension( char * FileName )
{
char * pDot;
- // find "dot" if it is present in the file name
-// pDot = strstr( FileName, "." );
+ // find the last "dot" in the file name, if it is present
for ( pDot = FileName + strlen(FileName)-1; pDot >= FileName; pDot-- )
if ( *pDot == '.' )
- break;
- if ( *pDot != '.' )
- return 0;
- // check the extension
- if ( pDot && strcmp( pDot+1, Extension ) == 0 )
- return 1;
- else
- return 0;
+ return pDot + 1;
+ return NULL;
}
/**Function*************************************************************
@@ -255,8 +248,8 @@ char * Extra_FileRead( FILE * pFile )
char * Extra_TimeStamp()
{
static char Buffer[100];
- time_t ltime;
char * TimeStamp;
+ time_t ltime;
// get the current time
time( &ltime );
TimeStamp = asctime( localtime( &ltime ) );
diff --git a/src/misc/extra/extraUtilMemory.c b/src/misc/extra/extraUtilMemory.c
index bc58527b..fff80ecf 100644
--- a/src/misc/extra/extraUtilMemory.c
+++ b/src/misc/extra/extraUtilMemory.c
@@ -155,18 +155,30 @@ Extra_MmFixed_t * Extra_MmFixedStart( int nEntrySize )
SeeAlso []
***********************************************************************/
-void Extra_MmFixedStop( Extra_MmFixed_t * p, int fVerbose )
+void Extra_MmFixedPrint( Extra_MmFixed_t * p )
+{
+ printf( "Fixed memory manager: Entry = %5d. Chunk = %5d. Chunks used = %5d.\n",
+ p->nEntrySize, p->nChunkSize, p->nChunks );
+ printf( " Entries used = %8d. Entries peak = %8d. Memory used = %8d. Memory alloc = %8d.\n",
+ p->nEntriesUsed, p->nEntriesMax, p->nEntrySize * p->nEntriesUsed, p->nMemoryAlloc );
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Extra_MmFixedStop( Extra_MmFixed_t * p )
{
int i;
if ( p == NULL )
return;
- if ( fVerbose )
- {
- printf( "Fixed memory manager: Entry = %5d. Chunk = %5d. Chunks used = %5d.\n",
- p->nEntrySize, p->nChunkSize, p->nChunks );
- printf( " Entries used = %8d. Entries peak = %8d. Memory used = %8d. Memory alloc = %8d.\n",
- p->nEntriesUsed, p->nEntriesMax, p->nEntrySize * p->nEntriesUsed, p->nMemoryAlloc );
- }
for ( i = 0; i < p->nChunks; i++ )
free( p->pChunks[i] );
free( p->pChunks );
@@ -343,18 +355,30 @@ Extra_MmFlex_t * Extra_MmFlexStart()
SeeAlso []
***********************************************************************/
-void Extra_MmFlexStop( Extra_MmFlex_t * p, int fVerbose )
+void Extra_MmFlexPrint( Extra_MmFlex_t * p )
+{
+ printf( "Flexible memory manager: Chunk size = %d. Chunks used = %d.\n",
+ p->nChunkSize, p->nChunks );
+ printf( " Entries used = %d. Memory used = %d. Memory alloc = %d.\n",
+ p->nEntriesUsed, p->nMemoryUsed, p->nMemoryAlloc );
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Extra_MmFlexStop( Extra_MmFlex_t * p )
{
int i;
if ( p == NULL )
return;
- if ( fVerbose )
- {
- printf( "Flexible memory manager: Chunk size = %d. Chunks used = %d.\n",
- p->nChunkSize, p->nChunks );
- printf( " Entries used = %d. Memory used = %d. Memory alloc = %d.\n",
- p->nEntriesUsed, p->nMemoryUsed, p->nMemoryAlloc );
- }
for ( i = 0; i < p->nChunks; i++ )
free( p->pChunks[i] );
free( p->pChunks );
@@ -482,11 +506,11 @@ Extra_MmStep_t * Extra_MmStepStart( int nSteps )
SeeAlso []
***********************************************************************/
-void Extra_MmStepStop( Extra_MmStep_t * p, int fVerbose )
+void Extra_MmStepStop( Extra_MmStep_t * p )
{
int i;
for ( i = 0; i < p->nMems; i++ )
- Extra_MmFixedStop( p->pMems[i], fVerbose );
+ Extra_MmFixedStop( p->pMems[i] );
// if ( p->pLargeChunks )
// {
// for ( i = 0; i < p->nLargeChunks; i++ )
diff --git a/src/misc/mvc/mvcMan.c b/src/misc/mvc/mvcMan.c
index 644e9805..7b4ef2af 100644
--- a/src/misc/mvc/mvcMan.c
+++ b/src/misc/mvc/mvcMan.c
@@ -63,10 +63,10 @@ Mvc_Manager_t * Mvc_ManagerStart()
***********************************************************************/
void Mvc_ManagerFree( Mvc_Manager_t * p )
{
- Extra_MmFixedStop( p->pMan1, 0 );
- Extra_MmFixedStop( p->pMan2, 0 );
- Extra_MmFixedStop( p->pMan4, 0 );
- Extra_MmFixedStop( p->pManC, 0 );
+ Extra_MmFixedStop( p->pMan1 );
+ Extra_MmFixedStop( p->pMan2 );
+ Extra_MmFixedStop( p->pMan4 );
+ Extra_MmFixedStop( p->pManC );
free( p );
}
diff --git a/src/misc/nm/nmApi.c b/src/misc/nm/nmApi.c
index 1306b497..c46866d5 100644
--- a/src/misc/nm/nmApi.c
+++ b/src/misc/nm/nmApi.c
@@ -72,7 +72,7 @@ Nm_Man_t * Nm_ManCreate( int nSize )
***********************************************************************/
void Nm_ManFree( Nm_Man_t * p )
{
- Extra_MmFlexStop( p->pMem, 0 );
+ Extra_MmFlexStop( p->pMem );
FREE( p->pBinsI2N );
FREE( p->pBinsN2I );
FREE( p );
diff --git a/src/misc/st/stmm.c b/src/misc/st/stmm.c
index c9b2320b..99485c23 100644
--- a/src/misc/st/stmm.c
+++ b/src/misc/st/stmm.c
@@ -105,7 +105,7 @@ stmm_free_table (table)
// no need to deallocate entries because they are in the memory manager now
// added by alanmi
if ( table->pMemMan )
- Extra_MmFixedStop (table->pMemMan, 0);
+ Extra_MmFixedStop (table->pMemMan);
FREE (table->bins);
FREE (table);
}
@@ -446,7 +446,7 @@ stmm_copy (old_table)
}
}
*/
- Extra_MmFixedStop (new_table->pMemMan, 0);
+ Extra_MmFixedStop (new_table->pMemMan);
FREE (new_table->bins);
FREE (new_table);
diff --git a/src/misc/vec/vecAtt.h b/src/misc/vec/vecAtt.h
index bfe3eac8..da7a8445 100644
--- a/src/misc/vec/vecAtt.h
+++ b/src/misc/vec/vecAtt.h
@@ -26,7 +26,6 @@
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
-#include "extra.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
@@ -46,9 +45,9 @@ typedef enum {
VEC_ATTR_LEVEL_REV, // 9
VEC_ATTR_RETIME_LAG, // 10
VEC_ATTR_FRAIG, // 11
- VEC_ATTR_DATA1, // 12
- VEC_ATTR_DATA2, // 13
- VEC_ATTR_DATA3, // 14
+ VEC_ATTR_MVVAR, // 12
+ VEC_ATTR_DATA1, // 13
+ VEC_ATTR_DATA2, // 14
VEC_ATTR_TOTAL_NUM // 15
} Vec_AttrType_t;
@@ -244,12 +243,12 @@ static inline void Vec_AttGrow( Vec_Att_t * p, int nCapMin )
if ( p->pArrayInt )
{
p->pArrayInt = REALLOC( int, p->pArrayInt, nCapMin );
- memset( p->pArrayInt + nCapMin, 0xff, sizeof(int) * (nCapMin - p->nCap) );
+ memset( p->pArrayInt + p->nCap, 0xff, sizeof(int) * (nCapMin - p->nCap) );
}
else
{
p->pArrayPtr = REALLOC( void *, p->pArrayPtr, nCapMin );
- memset( p->pArrayPtr + nCapMin, 0, sizeof(void *) * (nCapMin - p->nCap) );
+ memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) );
}
p->nCap = nCapMin;
}
@@ -270,7 +269,7 @@ static inline void Vec_AttWriteEntry( Vec_Att_t * p, int i, void * pEntry )
assert( p->pArrayPtr );
assert( p->pFuncStartObj == NULL );
if ( i >= p->nCap )
- Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i );
+ Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 );
p->pArrayPtr[i] = pEntry;
}
@@ -290,7 +289,7 @@ static inline void Vec_AttWriteEntryInt( Vec_Att_t * p, int i, int Entry )
assert( p->pArrayInt );
assert( p->pFuncStartObj == NULL );
if ( i >= p->nCap )
- Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i );
+ Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 );
p->pArrayInt[i] = Entry;
}
@@ -309,7 +308,7 @@ static inline void * Vec_AttEntry( Vec_Att_t * p, int i )
{
assert( p->pArrayPtr );
if ( i >= p->nCap )
- Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i );
+ Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 );
if ( p->pArrayPtr[i] == NULL && p->pFuncStartObj )
p->pArrayPtr[i] = p->pFuncStartObj( p->pMan );
return p->pArrayPtr[i];
@@ -331,7 +330,7 @@ static inline int Vec_AttEntryInt( Vec_Att_t * p, int i )
assert( p->pArrayInt );
assert( p->pMan == NULL );
if ( i >= p->nCap )
- Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i );
+ Vec_AttGrow( p, (2 * p->nCap > i)? 2 * p->nCap : i + 10 );
return p->pArrayInt[i];
}
diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h
index 93f59af9..1c9980e9 100644
--- a/src/misc/vec/vecFlt.h
+++ b/src/misc/vec/vecFlt.h
@@ -26,7 +26,6 @@
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
-#include "extra.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 10918156..75693895 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -25,6 +25,7 @@
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
+#include <stdio.h>
#include "extra.h"
////////////////////////////////////////////////////////////////////////
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index 3b8662ec..552c5293 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -26,7 +26,6 @@
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
-#include "extra.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h
index eb6aa41d..a03eb51e 100644
--- a/src/misc/vec/vecStr.h
+++ b/src/misc/vec/vecStr.h
@@ -26,7 +26,6 @@
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
-#include "extra.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h
index 5b725354..9176ec04 100644
--- a/src/misc/vec/vecVec.h
+++ b/src/misc/vec/vecVec.h
@@ -26,7 +26,6 @@
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
-#include "extra.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///