summaryrefslogtreecommitdiffstats
path: root/src/misc/vec/vecAtt.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-07-02 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-07-02 08:01:00 -0700
commit303baf27cf34c2a57db97c4c567fd744241fa14b (patch)
treed6235cca48e7bdfe5884e517058c7791e66bb806 /src/misc/vec/vecAtt.h
parentfa67e3c19e27c011517b91182eb3929412aaf402 (diff)
downloadabc-303baf27cf34c2a57db97c4c567fd744241fa14b.tar.gz
abc-303baf27cf34c2a57db97c4c567fd744241fa14b.tar.bz2
abc-303baf27cf34c2a57db97c4c567fd744241fa14b.zip
Version abc80702
Diffstat (limited to 'src/misc/vec/vecAtt.h')
-rw-r--r--src/misc/vec/vecAtt.h133
1 files changed, 16 insertions, 117 deletions
diff --git a/src/misc/vec/vecAtt.h b/src/misc/vec/vecAtt.h
index da7a8445..8d0a034b 100644
--- a/src/misc/vec/vecAtt.h
+++ b/src/misc/vec/vecAtt.h
@@ -60,7 +60,8 @@ struct Vec_Att_t_
{
// storage for attributes
int nCap; // the size of array allocated
- int * pArrayInt; // the integer attribute array
+ // Removed pArrayInt as it's not 64-bit safe, it generates compiler
+ // warnings, and it's unused.
void ** pArrayPtr; // the pointer attribute array
// attribute specific info
void * pMan; // the manager for this attribute
@@ -89,7 +90,7 @@ struct Vec_Att_t_
***********************************************************************/
static inline Vec_Att_t * Vec_AttAlloc(
- int fInteger, int nSize, void * pMan,
+ int nSize, void * pMan,
void (*pFuncFreeMan) (void *),
void*(*pFuncStartObj)(void *),
void (*pFuncFreeObj) (void *, void *) )
@@ -102,16 +103,8 @@ static inline Vec_Att_t * Vec_AttAlloc(
p->pFuncStartObj = pFuncStartObj;
p->pFuncFreeObj = pFuncFreeObj;
p->nCap = nSize? nSize : 16;
- if ( fInteger )
- {
- p->pArrayInt = ALLOC( int, p->nCap );
- memset( p->pArrayInt, 0xff, sizeof(int) * p->nCap );
- }
- else
- {
- p->pArrayPtr = ALLOC( void *, p->nCap );
- memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap );
- }
+ p->pArrayPtr = ALLOC( void *, p->nCap );
+ memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap );
return p;
}
@@ -135,24 +128,14 @@ static inline void * Vec_AttFree( Vec_Att_t * p, int fFreeMan )
if ( p->pFuncFreeObj )
{
int i;
- if ( p->pArrayInt )
- {
- for ( i = 0; i < p->nCap; i++ )
- if ( p->pArrayInt[i] )
- p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] );
- }
- else
- {
- for ( i = 0; i < p->nCap; i++ )
- if ( p->pArrayPtr[i] )
- p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] );
- }
+ for ( i = 0; i < p->nCap; i++ )
+ if ( p->pArrayPtr[i] )
+ p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] );
}
// free the memory manager
pMan = fFreeMan? NULL : p->pMan;
if ( p->pMan && fFreeMan )
p->pFuncFreeMan( p->pMan );
- FREE( p->pArrayInt );
FREE( p->pArrayPtr );
FREE( p );
return pMan;
@@ -175,26 +158,12 @@ static inline void Vec_AttClear( Vec_Att_t * p )
if ( p->pFuncFreeObj )
{
int i;
- if ( p->pArrayInt )
- {
- if ( p->pFuncFreeObj )
- for ( i = 0; i < p->nCap; i++ )
- if ( p->pArrayInt[i] )
- p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] );
- }
- else
- {
- if ( p->pFuncFreeObj )
- for ( i = 0; i < p->nCap; i++ )
- if ( p->pArrayPtr[i] )
- p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] );
- }
+ if ( p->pFuncFreeObj )
+ for ( i = 0; i < p->nCap; i++ )
+ if ( p->pArrayPtr[i] )
+ p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] );
}
- if ( p->pArrayInt )
- memset( p->pArrayInt, 0xff, sizeof(int) * p->nCap );
- else
- memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap );
-
+ memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap );
}
/**Function*************************************************************
@@ -214,15 +183,10 @@ static inline void Vec_AttFreeEntry( Vec_Att_t * p, int i )
return;
if ( p->pMan )
{
- if ( p->pArrayInt[i] && p->pFuncFreeObj )
- p->pFuncFreeObj( p->pMan, (void *)p->pArrayInt[i] );
if ( p->pArrayPtr[i] && p->pFuncFreeObj )
p->pFuncFreeObj( p->pMan, (void *)p->pArrayPtr[i] );
}
- if ( p->pArrayInt )
- p->pArrayInt[i] = ~(unsigned)0;
- else
- p->pArrayPtr[i] = NULL;
+ p->pArrayPtr[i] = NULL;
}
/**Function*************************************************************
@@ -240,16 +204,8 @@ static inline void Vec_AttGrow( Vec_Att_t * p, int nCapMin )
{
if ( p->nCap >= nCapMin )
return;
- if ( p->pArrayInt )
- {
- p->pArrayInt = REALLOC( int, p->pArrayInt, nCapMin );
- memset( p->pArrayInt + p->nCap, 0xff, sizeof(int) * (nCapMin - p->nCap) );
- }
- else
- {
- p->pArrayPtr = REALLOC( void *, p->pArrayPtr, nCapMin );
- memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) );
- }
+ p->pArrayPtr = REALLOC( void *, p->pArrayPtr, nCapMin );
+ memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) );
p->nCap = nCapMin;
}
@@ -275,26 +231,6 @@ static inline void Vec_AttWriteEntry( Vec_Att_t * p, int i, void * pEntry )
/**Function*************************************************************
- Synopsis [Writes the entry into its place.]
-
- Description [Only works if the manager is not defined.]
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-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 + 10 );
- p->pArrayInt[i] = Entry;
-}
-
-/**Function*************************************************************
-
Synopsis [Returns the entry.]
Description []
@@ -325,26 +261,6 @@ static inline void * Vec_AttEntry( Vec_Att_t * p, int i )
SeeAlso []
***********************************************************************/
-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 + 10 );
- return p->pArrayInt[i];
-}
-
-/**Function*************************************************************
-
- Synopsis [Returns the entry.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
static inline void * Vec_AttMan( Vec_Att_t * p )
{
return p->pMan;
@@ -366,25 +282,8 @@ static inline void ** Vec_AttArray( Vec_Att_t * p )
return p->pArrayPtr;
}
-/**Function*************************************************************
-
- Synopsis [Returns the array of attributes.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-static inline int * Vec_AttArrayInt( Vec_Att_t * p )
-{
- return p->pArrayInt;
-}
-
#endif
-
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////