Skip to content

Commit

Permalink
All hashtable functions are now static (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
empyreanx committed Jun 8, 2024
1 parent e36a693 commit d4fc2d4
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions cute_sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,20 +717,20 @@ before you include this file in *one* C/C++ file to create the implementation.

typedef struct hashtable_t hashtable_t;

void hashtable_init( hashtable_t* table, int item_size, int initial_capacity, void* memctx );
void hashtable_term( hashtable_t* table );
static void hashtable_init( hashtable_t* table, int item_size, int initial_capacity, void* memctx );
static void hashtable_term( hashtable_t* table );

void* hashtable_insert( hashtable_t* table, HASHTABLE_U64 key, void const* item );
void hashtable_remove( hashtable_t* table, HASHTABLE_U64 key );
void hashtable_clear( hashtable_t* table );
static void* hashtable_insert( hashtable_t* table, HASHTABLE_U64 key, void const* item );
static void hashtable_remove( hashtable_t* table, HASHTABLE_U64 key );
static void hashtable_clear( hashtable_t* table );

void* hashtable_find( hashtable_t const* table, HASHTABLE_U64 key );
static void* hashtable_find( hashtable_t const* table, HASHTABLE_U64 key );

int hashtable_count( hashtable_t const* table );
void* hashtable_items( hashtable_t const* table );
HASHTABLE_U64 const* hashtable_keys( hashtable_t const* table );
static int hashtable_count( hashtable_t const* table );
static void* hashtable_items( hashtable_t const* table );
static HASHTABLE_U64 const* hashtable_keys( hashtable_t const* table );

void hashtable_swap( hashtable_t* table, int index_a, int index_b );
static void hashtable_swap( hashtable_t* table, int index_a, int index_b );


#endif /* hashtable_h */
Expand Down Expand Up @@ -827,7 +827,7 @@ static HASHTABLE_U32 hashtable_internal_pow2ceil( HASHTABLE_U32 v )
}


void hashtable_init( hashtable_t* table, int item_size, int initial_capacity, void* memctx )
static void hashtable_init( hashtable_t* table, int item_size, int initial_capacity, void* memctx )
{
initial_capacity = (int)hashtable_internal_pow2ceil( initial_capacity >=0 ? (HASHTABLE_U32) initial_capacity : 32U );
table->memctx = memctx;
Expand All @@ -848,7 +848,7 @@ void hashtable_init( hashtable_t* table, int item_size, int initial_capacity, vo
}


void hashtable_term( hashtable_t* table )
static void hashtable_term( hashtable_t* table )
{
HASHTABLE_FREE( table->memctx, table->items_key );
HASHTABLE_FREE( table->memctx, table->slots );
Expand Down Expand Up @@ -957,7 +957,7 @@ static void hashtable_internal_expand_items( hashtable_t* table )
}


void* hashtable_insert( hashtable_t* table, HASHTABLE_U64 key, void const* item )
static void* hashtable_insert( hashtable_t* table, HASHTABLE_U64 key, void const* item )
{
HASHTABLE_ASSERT( hashtable_internal_find_slot( table, key ) < 0 );

Expand Down Expand Up @@ -1004,7 +1004,7 @@ void* hashtable_insert( hashtable_t* table, HASHTABLE_U64 key, void const* item
}


void hashtable_remove( hashtable_t* table, HASHTABLE_U64 key )
static void hashtable_remove( hashtable_t* table, HASHTABLE_U64 key )
{
int const slot = hashtable_internal_find_slot( table, key );
HASHTABLE_ASSERT( slot >= 0 );
Expand All @@ -1031,14 +1031,14 @@ void hashtable_remove( hashtable_t* table, HASHTABLE_U64 key )
}


void hashtable_clear( hashtable_t* table )
static void hashtable_clear( hashtable_t* table )
{
table->count = 0;
HASHTABLE_MEMSET( table->slots, 0, table->slot_capacity * sizeof( *table->slots ) );
}


void* hashtable_find( hashtable_t const* table, HASHTABLE_U64 key )
static void* hashtable_find( hashtable_t const* table, HASHTABLE_U64 key )
{
int const slot = hashtable_internal_find_slot( table, key );
if( slot < 0 ) return 0;
Expand All @@ -1049,25 +1049,25 @@ void* hashtable_find( hashtable_t const* table, HASHTABLE_U64 key )
}


int hashtable_count( hashtable_t const* table )
static int hashtable_count( hashtable_t const* table )
{
return table->count;
}


void* hashtable_items( hashtable_t const* table )
static void* hashtable_items( hashtable_t const* table )
{
return table->items_data;
}


HASHTABLE_U64 const* hashtable_keys( hashtable_t const* table )
static HASHTABLE_U64 const* hashtable_keys( hashtable_t const* table )
{
return table->items_key;
}


void hashtable_swap( hashtable_t* table, int index_a, int index_b )
static void hashtable_swap( hashtable_t* table, int index_a, int index_b )
{
if( index_a < 0 || index_a >= table->count || index_b < 0 || index_b >= table->count ) return;

Expand Down

0 comments on commit d4fc2d4

Please sign in to comment.