aboutsummaryrefslogtreecommitdiff
path: root/src/Hashmap.c
diff options
context:
space:
mode:
authorMikhail Romanko <me@blankhex.com>2025-09-06 23:40:32 +0300
committerMikhail Romanko <me@blankhex.com>2025-09-06 23:40:32 +0300
commit8d18e8020cba60c0b600c69c709ef1a63833a178 (patch)
treec8cb8075425a8e32839c4f1f7f168e0cb231c300 /src/Hashmap.c
parent4196e8f4c9148d0f0ff6572d5cc0a814150d72eb (diff)
downloadbhlib-8d18e8020cba60c0b600c69c709ef1a63833a178.tar.gz
Convert static func naming to same style
Previously, some modules used BH_<Module> prefix in the names of static functions (some used just <Module> prefix). Now every static function should start from lowercase.
Diffstat (limited to 'src/Hashmap.c')
-rw-r--r--src/Hashmap.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/Hashmap.c b/src/Hashmap.c
index 9f58abd..0bc5e5f 100644
--- a/src/Hashmap.c
+++ b/src/Hashmap.c
@@ -23,9 +23,9 @@ struct BH_Hashmap
};
-static void BH_HashmapInit(BH_Hashmap *hashmap,
- BH_EqualCallback equal,
- BH_HashCallback hash)
+static void hashmapInit(BH_Hashmap *hashmap,
+ BH_EqualCallback equal,
+ BH_HashCallback hash)
{
memset(hashmap, 0, sizeof(*hashmap));
hashmap->factor = 0.75f;
@@ -34,7 +34,7 @@ static void BH_HashmapInit(BH_Hashmap *hashmap,
}
-static void BH_HashmapDestroy(BH_Hashmap *hashmap)
+static void hashmapDestroy(BH_Hashmap *hashmap)
{
if (hashmap->capacity)
{
@@ -44,10 +44,10 @@ static void BH_HashmapDestroy(BH_Hashmap *hashmap)
}
-static int BH_CalcCapacity(size_t size,
- float factor,
- size_t *capacity,
- size_t *threshold)
+static int calcCapacity(size_t size,
+ float factor,
+ size_t *capacity,
+ size_t *threshold)
{
/* Check if we need any capacity at all */
if (!size)
@@ -78,8 +78,8 @@ static int BH_CalcCapacity(size_t size,
}
-static void BH_CopyHashmap(BH_Hashmap *dest,
- BH_Hashmap *src)
+static void copyHashmap(BH_Hashmap *dest,
+ BH_Hashmap *src)
{
void *iter;
@@ -105,7 +105,7 @@ BH_Hashmap *BH_HashmapNew(BH_EqualCallback equal,
result = malloc(sizeof(*result));
if (result)
- BH_HashmapInit(result, equal, hash);
+ hashmapInit(result, equal, hash);
return result;
}
@@ -113,7 +113,7 @@ BH_Hashmap *BH_HashmapNew(BH_EqualCallback equal,
void BH_HashmapFree(BH_Hashmap *hashmap)
{
- BH_HashmapDestroy(hashmap);
+ hashmapDestroy(hashmap);
free(hashmap);
}
@@ -137,7 +137,7 @@ int BH_HashmapReserve(BH_Hashmap *hashmap,
size = hashmap->size;
/* Calculate new capacity */
- if (BH_CalcCapacity(size, hashmap->factor, &capacity, &threshold))
+ if (calcCapacity(size, hashmap->factor, &capacity, &threshold))
return BH_OOM;
/* Prevent same size reallocation */
@@ -145,7 +145,7 @@ int BH_HashmapReserve(BH_Hashmap *hashmap,
return BH_OK;
/* Initialize new hashmap */
- BH_HashmapInit(&other, hashmap->equal, hashmap->hash);
+ hashmapInit(&other, hashmap->equal, hashmap->hash);
other.factor = hashmap->factor;
if (capacity)
@@ -170,11 +170,11 @@ int BH_HashmapReserve(BH_Hashmap *hashmap,
memset(other.psls, 0, sizeof(size_t) * other.capacity);
/* Copy data from old hashmap to the new hashmap */
- BH_CopyHashmap(&other, hashmap);
+ copyHashmap(&other, hashmap);
}
/* Swap hashmaps */
- BH_HashmapDestroy(hashmap);
+ hashmapDestroy(hashmap);
*hashmap = other;
return BH_OK;
}