renamed some functions

This commit is contained in:
Timerix 2025-07-19 03:38:33 +03:00
parent f7b0b53d05
commit c0c845bee8
4 changed files with 6 additions and 6 deletions

View File

@ -24,8 +24,8 @@ typedef struct HashMap {
u16 height_n;
} HashMap;
void HashMap_alloc(HashMap* ptr, u32 value_t_size, FreeFunction NULLABLE(value_destructor));
void HashMap_free(HashMap* ptr);
void HashMap_create(HashMap* ptr, u32 value_t_size, FreeFunction NULLABLE(value_destructor));
void HashMap_destroy(HashMap* ptr);
void* NULLABLE(HashMap_tryGetPtr)(HashMap* ptr, str key);
bool HashMap_tryPush(HashMap* ptr, str key, void* value_ptr);
bool HashMap_tryDelete(HashMap* ptr, str key);

View File

@ -10,7 +10,7 @@ typedef struct StringBuilder {
static inline StringBuilder StringBuilder_alloc(u32 initial_size) {
return (StringBuilder){ .buffer = List_alloc_size(initial_size) };
}
void StringBuilder_free(StringBuilder* b);
void StringBuilder_destroy(StringBuilder* b);
/// @param count set to -1 to clear StringBuilder
void StringBuilder_removeFromEnd(StringBuilder* b, u32 count);

View File

@ -12,7 +12,7 @@ static const Array __HashMap_heights = ARRAY(u32, {
8388617, 16777213, 33554467, 67108859, 134217757, 268435493
});
void HashMap_alloc(HashMap* ptr, u32 value_t_size, FreeFunction NULLABLE(value_destructor)){
void HashMap_create(HashMap* ptr, u32 value_t_size, FreeFunction NULLABLE(value_destructor)){
ptr->value_t_size = value_t_size;
ptr->value_destructor = value_destructor;
ptr->height_n = 0;
@ -22,7 +22,7 @@ void HashMap_alloc(HashMap* ptr, u32 value_t_size, FreeFunction NULLABLE(value_d
memset(ptr->table, 0, alloc_size);
}
void HashMap_free(HashMap* ptr){
void HashMap_destroy(HashMap* ptr){
for(u32 i = 0; i < ptr->height; i++){
HashMapBucket* bu = &ptr->table[i];
u32 len = List_len(&bu->key_hash_list, KeyHash);

View File

@ -1,6 +1,6 @@
#include "string/StringBuilder.h"
void StringBuilder_free(StringBuilder* b){
void StringBuilder_destroy(StringBuilder* b){
free(b->buffer.data);
b->buffer = List_construct_size(NULL, 0, 0);
}