Generally, changed working with tags as strings to as values.

This seems both cheaper and safer; what's not to like?
This commit is contained in:
Simon Brooke 2021-08-17 16:09:00 +01:00
parent eadb125b83
commit 93d4bd14a0
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
17 changed files with 87 additions and 88 deletions

View file

@ -78,17 +78,16 @@ void free_hashmap( struct cons_pointer pointer ) {
if ( hashmapp( pointer ) ) {
struct vector_space_object *vso = cell->payload.vectorp.address;
struct hashmap_payload payload = vso->payload.hashmap;
dec_ref( payload.hash_fn );
dec_ref( payload.write_acl );
dec_ref( vso->payload.hashmap.hash_fn );
dec_ref( vso->payload.hashmap.write_acl );
for ( int i = 0; i < payload.n_buckets; i++ ) {
if ( !nilp( payload.buckets[i] ) ) {
for ( int i = 0; i < vso->payload.hashmap.n_buckets; i++ ) {
if ( !nilp( vso->payload.hashmap.buckets[i] ) ) {
debug_printf( DEBUG_ALLOC,
L"Decrementing bucket [%d] of hashmap at 0x%lx\n", i,
cell->payload.vectorp.address );
dec_ref( payload.buckets[i] );
dec_ref( vso->payload.hashmap.buckets[i] );
}
}
} else {
@ -114,7 +113,7 @@ struct cons_pointer make_hashmap( uint32_t n_buckets,
struct cons_pointer hash_fn,
struct cons_pointer write_acl ) {
struct cons_pointer result =
make_vso( HASHTAG, ( sizeof( struct cons_pointer ) * ( n_buckets + 1 ) ) +
make_vso( HASHTV, ( sizeof( struct cons_pointer ) * ( n_buckets + 1 ) ) +
( sizeof( uint32_t ) * 2 ) );
struct hashmap_payload *payload =