summaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-01-24 00:59:12 +0000
committerMike Buland <eichlan@xagasoft.com>2009-01-24 00:59:12 +0000
commitdfd5f8696787d18ae688b662040289f84b667fdd (patch)
tree6307e987456088304383c4552551e2995aec16d3 /src/hash.h
parentb53b359c8d5079c996e47abafdf76781c4b1afc0 (diff)
downloadlibbu++-dfd5f8696787d18ae688b662040289f84b667fdd.tar.gz
libbu++-dfd5f8696787d18ae688b662040289f84b667fdd.tar.bz2
libbu++-dfd5f8696787d18ae688b662040289f84b667fdd.tar.xz
libbu++-dfd5f8696787d18ae688b662040289f84b667fdd.zip
Added some append and prepend functions and operators to Bu::List, now you can
append one list to another and the like. Also, wow, I found a bug that's been around for ages, I guess we don't copy hash tables often. The interesting thing is that it actually worked, it copied but it would include any data that had been deleted in the old hash table but not reclaimed yet and insert it as new data. Usually the key had been completely destroyed (like with a string) so it came out as keyed to blank string. So in cases like that, all deleted keys would collapse into one deleted key in the new hash table.
Diffstat (limited to 'src/hash.h')
-rw-r--r--src/hash.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/hash.h b/src/hash.h
index 8c58645..8856860 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -268,7 +268,7 @@ namespace Bu
268 268
269 for( uint32_t j = 0; j < src.nCapacity; j++ ) 269 for( uint32_t j = 0; j < src.nCapacity; j++ )
270 { 270 {
271 if( src.isFilled( j ) ) 271 if( src.isFilled( j ) && !src.isDeleted( j ) )
272 { 272 {
273 insert( src.aKeys[j], src.aValues[j] ); 273 insert( src.aKeys[j], src.aValues[j] );
274 } 274 }
@@ -283,12 +283,11 @@ namespace Bu
283 { 283 {
284 for( uint32_t j = 0; j < nCapacity; j++ ) 284 for( uint32_t j = 0; j < nCapacity; j++ )
285 { 285 {
286 if( isFilled( j ) ) 286 if( isFilled( j ) && !isDeleted( j ) )
287 if( !isDeleted( j ) ) 287 {
288 { 288 va.destroy( &aValues[j] );
289 va.destroy( &aValues[j] ); 289 ka.destroy( &aKeys[j] );
290 ka.destroy( &aKeys[j] ); 290 }
291 }
292 } 291 }
293 va.deallocate( aValues, nCapacity ); 292 va.deallocate( aValues, nCapacity );
294 ka.deallocate( aKeys, nCapacity ); 293 ka.deallocate( aKeys, nCapacity );
@@ -310,7 +309,7 @@ namespace Bu
310 309
311 for( uint32_t j = 0; j < src.nCapacity; j++ ) 310 for( uint32_t j = 0; j < src.nCapacity; j++ )
312 { 311 {
313 if( src.isFilled( j ) ) 312 if( src.isFilled( j ) && !src.isDeleted( j ) )
314 { 313 {
315 insert( src.aKeys[j], src.aValues[j] ); 314 insert( src.aKeys[j], src.aValues[j] );
316 } 315 }