diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2007-02-25 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2007-02-25 08:01:00 -0800 |
commit | 81fae91a95b8b51d7a10d3884df92dc89eb266bf (patch) | |
tree | 504f7581908335369a15d97653ba2bb3fec31d08 /src/misc | |
parent | fb51057e4a36d2e5737bba8739b88140b55db7c7 (diff) | |
download | abc-81fae91a95b8b51d7a10d3884df92dc89eb266bf.tar.gz abc-81fae91a95b8b51d7a10d3884df92dc89eb266bf.tar.bz2 abc-81fae91a95b8b51d7a10d3884df92dc89eb266bf.zip |
Version abc70225
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/extra/extra.h | 1 | ||||
-rw-r--r-- | src/misc/extra/extraUtilMemory.c | 18 | ||||
-rw-r--r-- | src/misc/vec/vecStr.h | 53 |
3 files changed, 71 insertions, 1 deletions
diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index 6937a8d4..1fff12d5 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -349,6 +349,7 @@ 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 ); +extern int Extra_MmFixedReadMaxEntriesUsed( Extra_MmFixed_t * p ); // flexible-size-block memory manager extern Extra_MmFlex_t * Extra_MmFlexStart(); extern void Extra_MmFlexStop( Extra_MmFlex_t * p ); diff --git a/src/misc/extra/extraUtilMemory.c b/src/misc/extra/extraUtilMemory.c index fff80ecf..6eccf015 100644 --- a/src/misc/extra/extraUtilMemory.c +++ b/src/misc/extra/extraUtilMemory.c @@ -310,6 +310,21 @@ int Extra_MmFixedReadMemUsage( Extra_MmFixed_t * p ) return p->nMemoryAlloc; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Extra_MmFixedReadMaxEntriesUsed( Extra_MmFixed_t * p ) +{ + return p->nEntriesMax; +} /**Function************************************************************* @@ -326,7 +341,7 @@ int Extra_MmFixedReadMemUsage( Extra_MmFixed_t * p ) Extra_MmFlex_t * Extra_MmFlexStart() { Extra_MmFlex_t * p; - +//printf( "allocing flex\n" ); p = ALLOC( Extra_MmFlex_t, 1 ); memset( p, 0, sizeof(Extra_MmFlex_t) ); @@ -379,6 +394,7 @@ void Extra_MmFlexStop( Extra_MmFlex_t * p ) int i; if ( p == NULL ) return; +//printf( "deleting flex\n" ); for ( i = 0; i < p->nChunks; i++ ) free( p->pChunks[i] ); free( p->pChunks ); diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index a03eb51e..38ac171d 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -403,6 +403,59 @@ static inline void Vec_StrPush( Vec_Str_t * p, char Entry ) /**Function************************************************************* + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_StrPrintNum( Vec_Str_t * p, int Num ) +{ + int i, nDigits; + if ( Num < 0 ) + { + Vec_StrPush( p, '-' ); + Num = -Num; + } + if ( Num < 10 ) + { + Vec_StrPush( p, (char)('0' + Num) ); + return; + } + nDigits = Extra_Base10Log( Num ); + Vec_StrGrow( p, p->nSize + nDigits ); + for ( i = nDigits - 1; i >= 0; i-- ) + { + Vec_StrWriteEntry( p, p->nSize + i, (char)('0' + Num % 10) ); + Num /= 10; + } + assert( Num == 0 ); + p->nSize += nDigits; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_StrPrintStr( Vec_Str_t * p, char * pStr ) +{ + int i, Length = strlen(pStr); + for ( i = 0; i < Length; i++ ) + Vec_StrPush( p, pStr[i] ); +} + +/**Function************************************************************* + Synopsis [Appends the string to the char vector.] Description [] |