diff options
author | Baruch Sterin <baruchs@gmail.com> | 2011-02-01 16:19:38 -0800 |
---|---|---|
committer | Baruch Sterin <baruchs@gmail.com> | 2011-02-01 16:19:38 -0800 |
commit | 35e05b7e5a422c3c075711eba3b4329c35ac426f (patch) | |
tree | 0594feba48403b8291f25d6bbf0df6610981fc62 /src/misc/hash | |
parent | 3a41da37a28535aed93abc3b91130539624fb3ca (diff) | |
parent | d4291dab37a647ac3d8d0f4e91e571bbb4e3553b (diff) | |
download | abc-35e05b7e5a422c3c075711eba3b4329c35ac426f.tar.gz abc-35e05b7e5a422c3c075711eba3b4329c35ac426f.tar.bz2 abc-35e05b7e5a422c3c075711eba3b4329c35ac426f.zip |
merge pyabc changes into mainline
Diffstat (limited to 'src/misc/hash')
-rw-r--r-- | src/misc/hash/hashFlt.h | 5 | ||||
-rw-r--r-- | src/misc/hash/hashPtr.h | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/misc/hash/hashFlt.h b/src/misc/hash/hashFlt.h index b4a8fb49..74e8503d 100644 --- a/src/misc/hash/hashFlt.h +++ b/src/misc/hash/hashFlt.h @@ -311,14 +311,15 @@ static inline void Hash_FltRemove( Hash_Flt_t *p, int key ) ***********************************************************************/ static inline void Hash_FltFree( Hash_Flt_t *p ) { int bin; - Hash_Flt_Entry_t *pEntry; + Hash_Flt_Entry_t *pEntry, *pTemp; // free bins for(bin = 0; bin < p->nBins; bin++) { pEntry = p->pArray[bin]; while(pEntry) { + pTemp = pEntry; pEntry = pEntry->pNext; - ABC_FREE( pEntry ); + ABC_FREE( pTemp ); } } diff --git a/src/misc/hash/hashPtr.h b/src/misc/hash/hashPtr.h index 9e510866..a10fb548 100644 --- a/src/misc/hash/hashPtr.h +++ b/src/misc/hash/hashPtr.h @@ -115,19 +115,17 @@ static inline Hash_Ptr_t * Hash_PtrAlloc( int nBins ) static inline int Hash_PtrExists( Hash_Ptr_t *p, int key ) { int bin; - Hash_Ptr_Entry_t *pEntry, **pLast; + Hash_Ptr_Entry_t *pEntry; // find the bin where this key would live bin = (*(p->fHash))(key, p->nBins); // search for key - pLast = &(p->pArray[bin]); pEntry = p->pArray[bin]; while(pEntry) { if (pEntry->key == key) { return 1; } - pLast = &(pEntry->pNext); pEntry = pEntry->pNext; } @@ -310,16 +308,18 @@ static inline void* Hash_PtrRemove( Hash_Ptr_t *p, int key ) SeeAlso [] ***********************************************************************/ -static inline void Hash_PtrFree( Hash_Ptr_t *p ) { +static inline void Hash_PtrFree( Hash_Ptr_t *p ) +{ int bin; - Hash_Ptr_Entry_t *pEntry; + Hash_Ptr_Entry_t *pEntry, *pTemp; // free bins for(bin = 0; bin < p->nBins; bin++) { pEntry = p->pArray[bin]; while(pEntry) { + pTemp = pEntry; pEntry = pEntry->pNext; - ABC_FREE( pEntry ); + ABC_FREE( pTemp ); } } |