Skip to content

Commit 4bd3d7b

Browse files
committed
Change comment format
1 parent b637c19 commit 4bd3d7b

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ cov-report
99
FlameGraph
1010
*.perf
1111
perf.*
12+
html/
13+
latex/

hashmap.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private int32_t _hashmap_find_index(hashmap *hm, char *key, uint32_t hash);
1414
/**
1515
* Allocate and initialize a new hashmap with default capacity
1616
*
17-
* Return: Pointer to new hashmap, or NULL if allocation fails
17+
* @return Pointer to new hashmap, or NULL if allocation fails
1818
*/
1919
hashmap *hashmap_init()
2020
{
@@ -37,7 +37,7 @@ hashmap *hashmap_init()
3737

3838
/**
3939
* Free all memory used by a hashmap
40-
* @hm: Hashmap to free
40+
* @param hm Hashmap to free
4141
*/
4242
void hashmap_free(hashmap *hm)
4343
{
@@ -61,16 +61,16 @@ void hashmap_free(hashmap *hm)
6161

6262
/**
6363
* Set a key-value pair in the hashmap
64-
* @hm: Hashmap to update
65-
* @key: String key to set
66-
* @value: Integer value to store
64+
* @param hm Hashmap to update
65+
* @param key String key to set
66+
* @param value Integer value to store
6767
*
6868
* If the key already exists, its value is updated.
6969
* If the key doesn't exist, a new entry is created.
7070
* The key string is copied, so the original can be freely modified
7171
* or deallocated after this call.
7272
*
73-
* Return: 0 on success, negative error code on failure
73+
* @return 0 on success, negative error code on failure
7474
*/
7575
int hashmap_set(hashmap *hm, char *key, int value)
7676
{
@@ -142,9 +142,9 @@ int hashmap_set(hashmap *hm, char *key, int value)
142142
/**
143143
* Resize hashmap if it's too full, i.e. the load factor is above
144144
* the threshold.
145-
* @hm: Hashmap to check
145+
* @param hm Hashmap to check
146146
*
147-
* Return: 0 on success, error code on failure
147+
* @return 0 on success, error code on failure
148148
*/
149149
private int hashmap_ensure_size(hashmap *hm)
150150
{
@@ -160,12 +160,12 @@ private int hashmap_ensure_size(hashmap *hm)
160160

161161
/**
162162
* Resize hashmap to a larger capacity.
163-
* @hm: Hashmap to resize
163+
* @param hm Hashmap to resize
164164
*
165165
* Creates a new, larger array and rehashes all existing items
166166
* into it. Deleted items are purged during the resize.
167167
*
168-
* Return: 0 on success, error code on failure
168+
* @return 0 on success, error code on failure
169169
*/
170170
private int hashmap_resize(hashmap *hm)
171171
{
@@ -221,13 +221,13 @@ private int hashmap_resize(hashmap *hm)
221221

222222
/**
223223
* Delete a key-value pair from the hashmap
224-
* @hm: Hashmap to modify
225-
* @key: Key to delete
224+
* @param hm Hashmap to modify
225+
* @param key Key to delete
226226
*
227227
* Mark the item as deleted and free associated key memory.
228228
* The slot remains occupied but marked as deleted until a resize.
229229
*
230-
* Return: 0 on success, error code on failure
230+
* @return 0 on success, error code on failure
231231
*/
232232
int hashmap_delete(hashmap *hm, char *key)
233233
{
@@ -251,10 +251,10 @@ int hashmap_delete(hashmap *hm, char *key)
251251

252252
/**
253253
* Get a value by key from the hashmap
254-
* @hm: Hashmap to search
255-
* @key: Key to look up
254+
* @param hm Hashmap to search
255+
* @param key Key to look up
256256
*
257-
* Return: Pointer to hashmap_item if found, NULL if not found
257+
* @return Pointer to hashmap_item if found, NULL if not found
258258
*/
259259
hashmap_item *hashmap_get(hashmap *hm, char *key)
260260
{
@@ -271,14 +271,14 @@ hashmap_item *hashmap_get(hashmap *hm, char *key)
271271

272272
/**
273273
* Find the array index of a key.
274-
* @hm: Hashmap to search
275-
* @key: Key to find
276-
* @hash: Pre-computed hash of the key
274+
* @param hm Hashmap to search
275+
* @param key Key to find
276+
* @param hash Pre-computed hash of the key
277277
*
278278
* Uses quadratic probing to handle collisions.
279279
* The probing sequence is derived from the CPython dict implementation.
280280
*
281-
* Return: Non-negative index if found, -E_HASHMAP_KEY_NOT_FOUND if not found
281+
* @return Non-negative index if found, -E_HASHMAP_KEY_NOT_FOUND if not found
282282
*/
283283
private int32_t _hashmap_find_index(hashmap *hm, char *key, uint32_t hash)
284284
{
@@ -311,13 +311,13 @@ private int32_t _hashmap_find_index(hashmap *hm, char *key, uint32_t hash)
311311

312312
/**
313313
* Find empty or deleted slot for insertion.
314-
* @hm: Hashmap to search
315-
* @hash: Hash value to use for probing
314+
* @param hm Hashmap to search
315+
* @param hash Hash value to use for probing
316316
*
317317
* Uses the same probing sequence as _hashmap_find_index to find
318318
* the first empty or deleted slot.
319319
*
320-
* Return: Index of empty/deleted slot, or -E_HASHMAP_KEY_NOT_FOUND if table is full
320+
* @return Index of empty/deleted slot, or -E_HASHMAP_KEY_NOT_FOUND if table is full
321321
*/
322322
private int32_t _hashmap_find_empty_index(hashmap *hm, uint32_t hash)
323323
{
@@ -345,12 +345,12 @@ private int32_t _hashmap_find_empty_index(hashmap *hm, uint32_t hash)
345345

346346
/**
347347
* DJB2 hash function for strings.
348-
* @s: String to hash
348+
* @param s String to hash
349349
*
350350
* This is the classic DJB2 hash algorithm:
351351
* hash(i) = hash(i-1) * 33 + str[i]
352352
*
353-
* Return: 32-bit hash value
353+
* @return 32-bit hash value
354354
*/
355355
unsigned long hash(char *s)
356356
{

0 commit comments

Comments
 (0)