diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2009-02-15 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2009-02-15 08:01:00 -0800 |
commit | 0871bffae307e0553e0c5186336189e8b55cf6a6 (patch) | |
tree | 4571d1563fe33a53a57fea1c35fb668b9d33265f /src/misc/vec | |
parent | f936cc0680c98ffe51b3a1716c996072d5dbf76c (diff) | |
download | abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.gz abc-0871bffae307e0553e0c5186336189e8b55cf6a6.tar.bz2 abc-0871bffae307e0553e0c5186336189e8b55cf6a6.zip |
Version abc90215
Diffstat (limited to 'src/misc/vec')
-rw-r--r-- | src/misc/vec/vec.h | 82 | ||||
-rw-r--r-- | src/misc/vec/vecAtt.h | 20 | ||||
-rw-r--r-- | src/misc/vec/vecFlt.h | 22 | ||||
-rw-r--r-- | src/misc/vec/vecInt.h | 24 | ||||
-rw-r--r-- | src/misc/vec/vecPtr.h | 52 | ||||
-rw-r--r-- | src/misc/vec/vecStr.h | 22 | ||||
-rw-r--r-- | src/misc/vec/vecVec.h | 4 |
7 files changed, 91 insertions, 135 deletions
diff --git a/src/misc/vec/vec.h b/src/misc/vec/vec.h index 67ec44aa..915265f3 100644 --- a/src/misc/vec/vec.h +++ b/src/misc/vec/vec.h @@ -21,93 +21,31 @@ #ifndef __VEC_H__ #define __VEC_H__ -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN32 -#define inline __inline // compatible with MS VS 6.0 -#pragma warning(disable : 4152) // warning C4152: nonstandard extension, function/data pointer conversion in expression -#pragma warning(disable : 4244) // warning C4244: '+=' : conversion from 'int ' to 'unsigned short ', possible loss of data -#pragma warning(disable : 4514) // warning C4514: 'Vec_StrPop' : unreferenced inline function has been removed -#pragma warning(disable : 4710) // warning C4710: function 'Vec_PtrGrow' not inlined -#endif - -#ifndef SINT64 -#define SINT64 - -#ifdef _WIN32 -typedef signed __int64 sint64; // compatible with MS VS 6.0 -#else -typedef long long sint64; -#endif - -#endif - //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// -// catch memory leaks in Visual Studio -#ifdef _DEBUG -#define _CRTDBG_MAP_ALLOC -#include <crtdbg.h> -#endif - -//////////////////////////////////////////////////////////////////////// -/// MACRO DEFINITIONS /// -//////////////////////////////////////////////////////////////////////// - -#ifndef ABS -#define ABS(a) ((a) < 0 ? -(a) : (a)) -#endif - -#ifndef MAX -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef ALLOC -#define ALLOC(type, num) ((type *) malloc(sizeof(type) * (num))) -#endif - -#ifndef CALLOC -#define CALLOC(type, num) ((type *) calloc((num), sizeof(type))) -#endif - -#ifndef FREE -#define FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0) -#endif - -#ifndef REALLOC -#define REALLOC(type, obj, num) \ - ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \ - ((type *) malloc(sizeof(type) * (num)))) -#endif - -#ifndef PRT -#define PRT(a,t) printf("%s = ", (a)); printf("%7.2f sec\n", (float)(t)/(float)(CLOCKS_PER_SEC)) -#endif - -#ifndef PRTP -#define PRTP(a,t,T) printf("%s = ", (a)); printf("%7.2f sec (%6.2f %%)\n", (float)(t)/(float)(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0) -#endif - +#include "abc_global.h" #include "vecInt.h" #include "vecFlt.h" #include "vecStr.h" #include "vecPtr.h" #include "vecVec.h" #include "vecAtt.h" -#include "port_type.h" + +//////////////////////////////////////////////////////////////////////// +/// MACRO DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// /// PARAMETERS /// //////////////////////////////////////////////////////////////////////// +#ifdef __cplusplus +extern "C" { +#endif + //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// //////////////////////////////////////////////////////////////////////// diff --git a/src/misc/vec/vecAtt.h b/src/misc/vec/vecAtt.h index 8d0a034b..9129321c 100644 --- a/src/misc/vec/vecAtt.h +++ b/src/misc/vec/vecAtt.h @@ -65,9 +65,9 @@ struct Vec_Att_t_ void ** pArrayPtr; // the pointer attribute array // attribute specific info void * pMan; // the manager for this attribute - void (*pFuncFreeMan) (void *); // the procedure to free the manager + void (*pFuncFreeMan) (void *); // the procedure to ABC_FREE the manager void*(*pFuncStartObj)(void *); // the procedure to start one attribute - void (*pFuncFreeObj) (void *, void *); // the procedure to free one attribute + void (*pFuncFreeObj) (void *, void *); // the procedure to ABC_FREE one attribute }; //////////////////////////////////////////////////////////////////////// @@ -96,14 +96,14 @@ static inline Vec_Att_t * Vec_AttAlloc( void (*pFuncFreeObj) (void *, void *) ) { Vec_Att_t * p; - p = ALLOC( Vec_Att_t, 1 ); + p = ABC_ALLOC( Vec_Att_t, 1 ); memset( p, 0, sizeof(Vec_Att_t) ); p->pMan = pMan; p->pFuncFreeMan = pFuncFreeMan; p->pFuncStartObj = pFuncStartObj; p->pFuncFreeObj = pFuncFreeObj; p->nCap = nSize? nSize : 16; - p->pArrayPtr = ALLOC( void *, p->nCap ); + p->pArrayPtr = ABC_ALLOC( void *, p->nCap ); memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap ); return p; } @@ -124,7 +124,7 @@ static inline void * Vec_AttFree( Vec_Att_t * p, int fFreeMan ) void * pMan; if ( p == NULL ) return NULL; - // free the attributes of objects + // ABC_FREE the attributes of objects if ( p->pFuncFreeObj ) { int i; @@ -132,12 +132,12 @@ static inline void * Vec_AttFree( Vec_Att_t * p, int fFreeMan ) if ( p->pArrayPtr[i] ) p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] ); } - // free the memory manager + // ABC_FREE the memory manager pMan = fFreeMan? NULL : p->pMan; if ( p->pMan && fFreeMan ) p->pFuncFreeMan( p->pMan ); - FREE( p->pArrayPtr ); - FREE( p ); + ABC_FREE( p->pArrayPtr ); + ABC_FREE( p ); return pMan; } @@ -154,7 +154,7 @@ static inline void * Vec_AttFree( Vec_Att_t * p, int fFreeMan ) ***********************************************************************/ static inline void Vec_AttClear( Vec_Att_t * p ) { - // free the attributes of objects + // ABC_FREE the attributes of objects if ( p->pFuncFreeObj ) { int i; @@ -204,7 +204,7 @@ static inline void Vec_AttGrow( Vec_Att_t * p, int nCapMin ) { if ( p->nCap >= nCapMin ) return; - p->pArrayPtr = REALLOC( void *, p->pArrayPtr, nCapMin ); + p->pArrayPtr = ABC_REALLOC( void *, p->pArrayPtr, nCapMin ); memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) ); p->nCap = nCapMin; } diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h index 513c7dc6..93402cf2 100644 --- a/src/misc/vec/vecFlt.h +++ b/src/misc/vec/vecFlt.h @@ -74,12 +74,12 @@ struct Vec_Flt_t_ static inline Vec_Flt_t * Vec_FltAlloc( int nCap ) { Vec_Flt_t * p; - p = ALLOC( Vec_Flt_t, 1 ); + p = ABC_ALLOC( Vec_Flt_t, 1 ); if ( nCap > 0 && nCap < 16 ) nCap = 16; p->nSize = 0; p->nCap = nCap; - p->pArray = p->nCap? ALLOC( float, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( float, p->nCap ) : NULL; return p; } @@ -117,7 +117,7 @@ static inline Vec_Flt_t * Vec_FltStart( int nSize ) static inline Vec_Flt_t * Vec_FltAllocArray( float * pArray, int nSize ) { Vec_Flt_t * p; - p = ALLOC( Vec_Flt_t, 1 ); + p = ABC_ALLOC( Vec_Flt_t, 1 ); p->nSize = nSize; p->nCap = nSize; p->pArray = pArray; @@ -138,10 +138,10 @@ static inline Vec_Flt_t * Vec_FltAllocArray( float * pArray, int nSize ) static inline Vec_Flt_t * Vec_FltAllocArrayCopy( float * pArray, int nSize ) { Vec_Flt_t * p; - p = ALLOC( Vec_Flt_t, 1 ); + p = ABC_ALLOC( Vec_Flt_t, 1 ); p->nSize = nSize; p->nCap = nSize; - p->pArray = ALLOC( float, nSize ); + p->pArray = ABC_ALLOC( float, nSize ); memcpy( p->pArray, pArray, sizeof(float) * nSize ); return p; } @@ -160,10 +160,10 @@ static inline Vec_Flt_t * Vec_FltAllocArrayCopy( float * pArray, int nSize ) static inline Vec_Flt_t * Vec_FltDup( Vec_Flt_t * pVec ) { Vec_Flt_t * p; - p = ALLOC( Vec_Flt_t, 1 ); + p = ABC_ALLOC( Vec_Flt_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; - p->pArray = p->nCap? ALLOC( float, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( float, p->nCap ) : NULL; memcpy( p->pArray, pVec->pArray, sizeof(float) * pVec->nSize ); return p; } @@ -182,7 +182,7 @@ static inline Vec_Flt_t * Vec_FltDup( Vec_Flt_t * pVec ) static inline Vec_Flt_t * Vec_FltDupArray( Vec_Flt_t * pVec ) { Vec_Flt_t * p; - p = ALLOC( Vec_Flt_t, 1 ); + p = ABC_ALLOC( Vec_Flt_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = pVec->pArray; @@ -205,8 +205,8 @@ static inline Vec_Flt_t * Vec_FltDupArray( Vec_Flt_t * pVec ) ***********************************************************************/ static inline void Vec_FltFree( Vec_Flt_t * p ) { - FREE( p->pArray ); - FREE( p ); + ABC_FREE( p->pArray ); + ABC_FREE( p ); } /**Function************************************************************* @@ -343,7 +343,7 @@ static inline void Vec_FltGrow( Vec_Flt_t * p, int nCapMin ) { if ( p->nCap >= nCapMin ) return; - p->pArray = REALLOC( float, p->pArray, nCapMin ); + p->pArray = ABC_REALLOC( float, p->pArray, nCapMin ); p->nCap = nCapMin; } diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index c944df3f..0f7a41ab 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -51,6 +51,8 @@ struct Vec_Int_t_ for ( i = 0; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ ) #define Vec_IntForEachEntryStart( vVec, Entry, i, Start ) \ for ( i = Start; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ ) +#define Vec_IntForEachEntryStop( vVec, Entry, i, Stop ) \ + for ( i = 0; (i < Stop) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ ) #define Vec_IntForEachEntryStartStop( vVec, Entry, i, Start, Stop ) \ for ( i = Start; (i < Stop) && (((Entry) = Vec_IntEntry(vVec, i)), 1); i++ ) #define Vec_IntForEachEntryReverse( vVec, pEntry, i ) \ @@ -74,12 +76,12 @@ struct Vec_Int_t_ static inline Vec_Int_t * Vec_IntAlloc( int nCap ) { Vec_Int_t * p; - p = ALLOC( Vec_Int_t, 1 ); + p = ABC_ALLOC( Vec_Int_t, 1 ); if ( nCap > 0 && nCap < 16 ) nCap = 16; p->nSize = 0; p->nCap = nCap; - p->pArray = p->nCap? ALLOC( int, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( int, p->nCap ) : NULL; return p; } @@ -139,7 +141,7 @@ static inline Vec_Int_t * Vec_IntStartNatural( int nSize ) static inline Vec_Int_t * Vec_IntAllocArray( int * pArray, int nSize ) { Vec_Int_t * p; - p = ALLOC( Vec_Int_t, 1 ); + p = ABC_ALLOC( Vec_Int_t, 1 ); p->nSize = nSize; p->nCap = nSize; p->pArray = pArray; @@ -160,10 +162,10 @@ static inline Vec_Int_t * Vec_IntAllocArray( int * pArray, int nSize ) static inline Vec_Int_t * Vec_IntAllocArrayCopy( int * pArray, int nSize ) { Vec_Int_t * p; - p = ALLOC( Vec_Int_t, 1 ); + p = ABC_ALLOC( Vec_Int_t, 1 ); p->nSize = nSize; p->nCap = nSize; - p->pArray = ALLOC( int, nSize ); + p->pArray = ABC_ALLOC( int, nSize ); memcpy( p->pArray, pArray, sizeof(int) * nSize ); return p; } @@ -182,10 +184,10 @@ static inline Vec_Int_t * Vec_IntAllocArrayCopy( int * pArray, int nSize ) static inline Vec_Int_t * Vec_IntDup( Vec_Int_t * pVec ) { Vec_Int_t * p; - p = ALLOC( Vec_Int_t, 1 ); + p = ABC_ALLOC( Vec_Int_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nSize; - p->pArray = p->nCap? ALLOC( int, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( int, p->nCap ) : NULL; memcpy( p->pArray, pVec->pArray, sizeof(int) * pVec->nSize ); return p; } @@ -204,7 +206,7 @@ static inline Vec_Int_t * Vec_IntDup( Vec_Int_t * pVec ) static inline Vec_Int_t * Vec_IntDupArray( Vec_Int_t * pVec ) { Vec_Int_t * p; - p = ALLOC( Vec_Int_t, 1 ); + p = ABC_ALLOC( Vec_Int_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = pVec->pArray; @@ -227,8 +229,8 @@ static inline Vec_Int_t * Vec_IntDupArray( Vec_Int_t * pVec ) ***********************************************************************/ static inline void Vec_IntFree( Vec_Int_t * p ) { - FREE( p->pArray ); - FREE( p ); + ABC_FREE( p->pArray ); + ABC_FREE( p ); } /**Function************************************************************* @@ -366,7 +368,7 @@ static inline void Vec_IntGrow( Vec_Int_t * p, int nCapMin ) { if ( p->nCap >= nCapMin ) return; - p->pArray = REALLOC( int, p->pArray, nCapMin ); + p->pArray = ABC_REALLOC( int, p->pArray, nCapMin ); assert( p->pArray ); p->nCap = nCapMin; } diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index 27643043..4d09acb7 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -77,12 +77,12 @@ struct Vec_Ptr_t_ static inline Vec_Ptr_t * Vec_PtrAlloc( int nCap ) { Vec_Ptr_t * p; - p = ALLOC( Vec_Ptr_t, 1 ); + p = ABC_ALLOC( Vec_Ptr_t, 1 ); if ( nCap > 0 && nCap < 8 ) nCap = 8; p->nSize = 0; p->nCap = nCap; - p->pArray = p->nCap? ALLOC( void *, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( void *, p->nCap ) : NULL; return p; } @@ -120,7 +120,7 @@ static inline Vec_Ptr_t * Vec_PtrStart( int nSize ) static inline Vec_Ptr_t * Vec_PtrAllocArray( void ** pArray, int nSize ) { Vec_Ptr_t * p; - p = ALLOC( Vec_Ptr_t, 1 ); + p = ABC_ALLOC( Vec_Ptr_t, 1 ); p->nSize = nSize; p->nCap = nSize; p->pArray = pArray; @@ -141,10 +141,10 @@ static inline Vec_Ptr_t * Vec_PtrAllocArray( void ** pArray, int nSize ) static inline Vec_Ptr_t * Vec_PtrAllocArrayCopy( void ** pArray, int nSize ) { Vec_Ptr_t * p; - p = ALLOC( Vec_Ptr_t, 1 ); + p = ABC_ALLOC( Vec_Ptr_t, 1 ); p->nSize = nSize; p->nCap = nSize; - p->pArray = ALLOC( void *, nSize ); + p->pArray = ABC_ALLOC( void *, nSize ); memcpy( p->pArray, pArray, sizeof(void *) * nSize ); return p; } @@ -163,10 +163,10 @@ static inline Vec_Ptr_t * Vec_PtrAllocArrayCopy( void ** pArray, int nSize ) static inline Vec_Ptr_t * Vec_PtrDup( Vec_Ptr_t * pVec ) { Vec_Ptr_t * p; - p = ALLOC( Vec_Ptr_t, 1 ); + p = ABC_ALLOC( Vec_Ptr_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; - p->pArray = p->nCap? ALLOC( void *, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( void *, p->nCap ) : NULL; memcpy( p->pArray, pVec->pArray, sizeof(void *) * pVec->nSize ); return p; } @@ -185,7 +185,7 @@ static inline Vec_Ptr_t * Vec_PtrDup( Vec_Ptr_t * pVec ) static inline Vec_Ptr_t * Vec_PtrDupArray( Vec_Ptr_t * pVec ) { Vec_Ptr_t * p; - p = ALLOC( Vec_Ptr_t, 1 ); + p = ABC_ALLOC( Vec_Ptr_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = pVec->pArray; @@ -208,8 +208,8 @@ static inline Vec_Ptr_t * Vec_PtrDupArray( Vec_Ptr_t * pVec ) ***********************************************************************/ static inline void Vec_PtrFree( Vec_Ptr_t * p ) { - FREE( p->pArray ); - FREE( p ); + ABC_FREE( p->pArray ); + ABC_FREE( p ); } /**Function************************************************************* @@ -347,7 +347,7 @@ static inline void Vec_PtrGrow( Vec_Ptr_t * p, int nCapMin ) { if ( p->nCap >= nCapMin ) return; - p->pArray = REALLOC( void *, p->pArray, nCapMin ); + p->pArray = ABC_REALLOC( void *, p->pArray, nCapMin ); p->nCap = nCapMin; } @@ -678,7 +678,7 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords ) void ** pMemory; unsigned * pInfo; int i; - pMemory = (void **)ALLOC( char, (sizeof(void *) + sizeof(unsigned) * nWords) * nEntries ); + pMemory = (void **)ABC_ALLOC( char, (sizeof(void *) + sizeof(unsigned) * nWords) * nEntries ); pInfo = (unsigned *)(pMemory + nEntries); for ( i = 0; i < nEntries; i++ ) pMemory[i] = pInfo + i * nWords; @@ -696,6 +696,22 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords ) SeeAlso [] ***********************************************************************/ +static inline int Vec_PtrReadWordsSimInfo( Vec_Ptr_t * p ) +{ + return (unsigned *)Vec_PtrEntry(p,1) - (unsigned *)Vec_PtrEntry(p,0); +} + +/**Function************************************************************* + + Synopsis [Cleans simulation info of each entry beginning with iWord.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ static inline void Vec_PtrCleanSimInfo( Vec_Ptr_t * vInfo, int iWord, int nWords ) { int i; @@ -743,13 +759,13 @@ static inline void Vec_PtrDoubleSimInfo( Vec_Ptr_t * vInfo ) // copy the simulation info memcpy( Vec_PtrEntry(vInfoNew,0), Vec_PtrEntry(vInfo,0), Vec_PtrSize(vInfo) * nWords * 4 ); // replace the array - free( vInfo->pArray ); + ABC_FREE( vInfo->pArray ); vInfo->pArray = vInfoNew->pArray; vInfo->nSize *= 2; vInfo->nCap *= 2; - // free the old array + // ABC_FREE the old array vInfoNew->pArray = NULL; - free( vInfoNew ); + ABC_FREE( vInfoNew ); } /**Function************************************************************* @@ -775,11 +791,11 @@ static inline void Vec_PtrReallocSimInfo( Vec_Ptr_t * vInfo ) for ( i = 0; i < vInfo->nSize; i++ ) memcpy( Vec_PtrEntry(vInfoNew,i), Vec_PtrEntry(vInfo,i), nWords * 4 ); // replace the array - free( vInfo->pArray ); + ABC_FREE( vInfo->pArray ); vInfo->pArray = vInfoNew->pArray; - // free the old array + // ABC_FREE the old array vInfoNew->pArray = NULL; - free( vInfoNew ); + ABC_FREE( vInfoNew ); } /**Function************************************************************* diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index a00aaa68..dc0b2bad 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -68,12 +68,12 @@ struct Vec_Str_t_ static inline Vec_Str_t * Vec_StrAlloc( int nCap ) { Vec_Str_t * p; - p = ALLOC( Vec_Str_t, 1 ); + p = ABC_ALLOC( Vec_Str_t, 1 ); if ( nCap > 0 && nCap < 16 ) nCap = 16; p->nSize = 0; p->nCap = nCap; - p->pArray = p->nCap? ALLOC( char, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( char, p->nCap ) : NULL; return p; } @@ -111,7 +111,7 @@ static inline Vec_Str_t * Vec_StrStart( int nSize ) static inline Vec_Str_t * Vec_StrAllocArray( char * pArray, int nSize ) { Vec_Str_t * p; - p = ALLOC( Vec_Str_t, 1 ); + p = ABC_ALLOC( Vec_Str_t, 1 ); p->nSize = nSize; p->nCap = nSize; p->pArray = pArray; @@ -132,10 +132,10 @@ static inline Vec_Str_t * Vec_StrAllocArray( char * pArray, int nSize ) static inline Vec_Str_t * Vec_StrAllocArrayCopy( char * pArray, int nSize ) { Vec_Str_t * p; - p = ALLOC( Vec_Str_t, 1 ); + p = ABC_ALLOC( Vec_Str_t, 1 ); p->nSize = nSize; p->nCap = nSize; - p->pArray = ALLOC( char, nSize ); + p->pArray = ABC_ALLOC( char, nSize ); memcpy( p->pArray, pArray, sizeof(char) * nSize ); return p; } @@ -154,10 +154,10 @@ static inline Vec_Str_t * Vec_StrAllocArrayCopy( char * pArray, int nSize ) static inline Vec_Str_t * Vec_StrDup( Vec_Str_t * pVec ) { Vec_Str_t * p; - p = ALLOC( Vec_Str_t, 1 ); + p = ABC_ALLOC( Vec_Str_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; - p->pArray = p->nCap? ALLOC( char, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( char, p->nCap ) : NULL; memcpy( p->pArray, pVec->pArray, sizeof(char) * pVec->nSize ); return p; } @@ -176,7 +176,7 @@ static inline Vec_Str_t * Vec_StrDup( Vec_Str_t * pVec ) static inline Vec_Str_t * Vec_StrDupArray( Vec_Str_t * pVec ) { Vec_Str_t * p; - p = ALLOC( Vec_Str_t, 1 ); + p = ABC_ALLOC( Vec_Str_t, 1 ); p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = pVec->pArray; @@ -199,8 +199,8 @@ static inline Vec_Str_t * Vec_StrDupArray( Vec_Str_t * pVec ) ***********************************************************************/ static inline void Vec_StrFree( Vec_Str_t * p ) { - FREE( p->pArray ); - FREE( p ); + ABC_FREE( p->pArray ); + ABC_FREE( p ); } /**Function************************************************************* @@ -321,7 +321,7 @@ static inline void Vec_StrGrow( Vec_Str_t * p, int nCapMin ) { if ( p->nCap >= nCapMin ) return; - p->pArray = REALLOC( char, p->pArray, 2 * nCapMin ); + p->pArray = ABC_REALLOC( char, p->pArray, 2 * nCapMin ); p->nCap = 2 * nCapMin; } diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h index 0557e9c0..a77cdf76 100644 --- a/src/misc/vec/vecVec.h +++ b/src/misc/vec/vecVec.h @@ -99,12 +99,12 @@ struct Vec_Vec_t_ static inline Vec_Vec_t * Vec_VecAlloc( int nCap ) { Vec_Vec_t * p; - p = ALLOC( Vec_Vec_t, 1 ); + p = ABC_ALLOC( Vec_Vec_t, 1 ); if ( nCap > 0 && nCap < 8 ) nCap = 8; p->nSize = 0; p->nCap = nCap; - p->pArray = p->nCap? ALLOC( void *, p->nCap ) : NULL; + p->pArray = p->nCap? ABC_ALLOC( void *, p->nCap ) : NULL; return p; } |