diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-23 23:22:12 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-05-23 23:22:12 -0700 |
commit | ac037cbb966285b724c8bbf776195855dc4a558f (patch) | |
tree | 3fe4ff4f4727148d594f4a3e70e42b8f1126ccaa /src/misc/vec | |
parent | 78d60d98a857c5683eae40ce17813be26fe5f004 (diff) | |
download | abc-ac037cbb966285b724c8bbf776195855dc4a558f.tar.gz abc-ac037cbb966285b724c8bbf776195855dc4a558f.tar.bz2 abc-ac037cbb966285b724c8bbf776195855dc4a558f.zip |
New MFS package.
Diffstat (limited to 'src/misc/vec')
-rw-r--r-- | src/misc/vec/vecWec.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/misc/vec/vecWec.h b/src/misc/vec/vecWec.h index ece7b0a1..a70d92ad 100644 --- a/src/misc/vec/vecWec.h +++ b/src/misc/vec/vecWec.h @@ -122,6 +122,11 @@ static inline void Vec_WecGrow( Vec_Wec_t * p, int nCapMin ) memset( p->pArray + p->nCap, 0, sizeof(Vec_Int_t) * (nCapMin - p->nCap) ); p->nCap = nCapMin; } +static inline void Vec_WecInit( Vec_Wec_t * p, int nSize ) +{ + Vec_WecGrow( p, nSize ); + p->nSize = nSize; +} /**Function************************************************************* @@ -314,12 +319,24 @@ static inline double Vec_WecMemory( Vec_Wec_t * p ) SeeAlso [] ***********************************************************************/ -static inline void Vec_WecFree( Vec_Wec_t * p ) +static inline void Vec_WecZero( Vec_Wec_t * p ) +{ + p->pArray = NULL; + p->nSize = 0; + p->nCap = 0; +} +static inline void Vec_WecErase( Vec_Wec_t * p ) { int i; for ( i = 0; i < p->nCap; i++ ) ABC_FREE( p->pArray[i].pArray ); ABC_FREE( p->pArray ); + p->nSize = 0; + p->nCap = 0; +} +static inline void Vec_WecFree( Vec_Wec_t * p ) +{ + Vec_WecErase( p ); ABC_FREE( p ); } static inline void Vec_WecFreeP( Vec_Wec_t ** p ) |