hashmap: adjust spacing to fix argument alignment
No actual code changes; just whitespace adjustments. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Nov 2, 2020 at 18:55 UTC
97a39a4a930ebec9162f90ebd0412aed47d413d0
2 files changed
+20
-19
hashmap.c
+9
-8
@@ -92,8 +92,9 @@ static void alloc_table(struct hashmap *map, unsigned int size)
92
}
93
94
static inline int entry_equals(const struct hashmap *map,
95
- const struct hashmap_entry *e1, const struct hashmap_entry *e2,
96
- const void *keydata)
95
+ const struct hashmap_entry *e1,
96
+ const struct hashmap_entry *e2,
97
+ const void *keydata)
98
{
99
return (e1 == e2) ||
100
(e1->hash == e2->hash &&
@@ -101,7 +102,7 @@ static inline int entry_equals(const struct hashmap *map,
102
}
103
104
static inline unsigned int bucket(const struct hashmap *map,
104
- const struct hashmap_entry *key)
105
+ const struct hashmap_entry *key)
106
{
107
return key->hash & (map->tablesize - 1);
108
}
@@ -148,7 +149,7 @@ static int always_equal(const void *unused_cmp_data,
149
}
150
151
void hashmap_init(struct hashmap *map, hashmap_cmp_fn equals_function,
151
- const void *cmpfn_data, size_t initial_size)
152
+ const void *cmpfn_data, size_t initial_size)
153
{
154
unsigned int size = HASHMAP_INITIAL_SIZE;
155
@@ -199,7 +200,7 @@ struct hashmap_entry *hashmap_get(const struct hashmap *map,
200
}
201
202
struct hashmap_entry *hashmap_get_next(const struct hashmap *map,
202
- const struct hashmap_entry *entry)
203
+ const struct hashmap_entry *entry)
204
{
205
struct hashmap_entry *e = entry->next;
206
for (; e; e = e->next)
@@ -225,8 +226,8 @@ void hashmap_add(struct hashmap *map, struct hashmap_entry *entry)
226
}
227
228
struct hashmap_entry *hashmap_remove(struct hashmap *map,
228
- const struct hashmap_entry *key,
229
- const void *keydata)
229
+ const struct hashmap_entry *key,
230
+ const void *keydata)
231
{
232
struct hashmap_entry *old;
233
struct hashmap_entry **e = find_entry_ptr(map, key, keydata);
@@ -249,7 +250,7 @@ struct hashmap_entry *hashmap_remove(struct hashmap *map,
250
}
251
252
struct hashmap_entry *hashmap_put(struct hashmap *map,
252
- struct hashmap_entry *entry)
253
+ struct hashmap_entry *entry)
254
{
255
struct hashmap_entry *old = hashmap_remove(map, entry, NULL);
256
hashmap_add(map, entry);
hashmap.h
+11
-11
@@ -228,9 +228,9 @@ struct hashmap {
228
* prevent expensive resizing. If 0, the table is dynamically resized.
229
*/
230
void hashmap_init(struct hashmap *map,
231
- hashmap_cmp_fn equals_function,
232
- const void *equals_function_data,
233
- size_t initial_size);
231
+ hashmap_cmp_fn equals_function,
232
+ const void *equals_function_data,
233
+ size_t initial_size);
234
235
/* internal function for freeing hashmap */
236
void hashmap_free_(struct hashmap *map, ssize_t offset);
@@ -288,7 +288,7 @@ void hashmap_free_(struct hashmap *map, ssize_t offset);
288
* and if it is on stack, you can just let it go out of scope).
289
*/
290
static inline void hashmap_entry_init(struct hashmap_entry *e,
291
- unsigned int hash)
291
+ unsigned int hash)
292
{
293
e->hash = hash;
294
e->next = NULL;
@@ -330,8 +330,8 @@ static inline unsigned int hashmap_get_size(struct hashmap *map)
330
* to `hashmap_cmp_fn` to decide whether the entry matches the key.
331
*/
332
struct hashmap_entry *hashmap_get(const struct hashmap *map,
333
- const struct hashmap_entry *key,
334
- const void *keydata);
333
+ const struct hashmap_entry *key,
334
+ const void *keydata);
335
336
/*
337
* Returns the hashmap entry for the specified hash code and key data,
@@ -364,7 +364,7 @@ static inline struct hashmap_entry *hashmap_get_from_hash(
364
* call to `hashmap_get` or `hashmap_get_next`.
365
*/
366
struct hashmap_entry *hashmap_get_next(const struct hashmap *map,
367
- const struct hashmap_entry *entry);
367
+ const struct hashmap_entry *entry);
368
369
/*
370
* Adds a hashmap entry. This allows to add duplicate entries (i.e.
@@ -384,7 +384,7 @@ void hashmap_add(struct hashmap *map, struct hashmap_entry *entry);
384
* Returns the replaced entry, or NULL if not found (i.e. the entry was added).
385
*/
386
struct hashmap_entry *hashmap_put(struct hashmap *map,
387
- struct hashmap_entry *entry);
387
+ struct hashmap_entry *entry);
388
389
/*
390
* Adds or replaces a hashmap entry contained within @keyvar,
@@ -406,8 +406,8 @@ struct hashmap_entry *hashmap_put(struct hashmap *map,
406
* Argument explanation is the same as in `hashmap_get`.
407
*/
408
struct hashmap_entry *hashmap_remove(struct hashmap *map,
409
- const struct hashmap_entry *key,
410
- const void *keydata);
409
+ const struct hashmap_entry *key,
410
+ const void *keydata);
411
412
/*
413
* Removes a hashmap entry contained within @keyvar,
@@ -449,7 +449,7 @@ struct hashmap_entry *hashmap_iter_next(struct hashmap_iter *iter);
449
450
/* Initializes the iterator and returns the first entry, if any. */
451
static inline struct hashmap_entry *hashmap_iter_first(struct hashmap *map,
452
- struct hashmap_iter *iter)
452
+ struct hashmap_iter *iter)
453
{
454
hashmap_iter_init(map, iter);
455
return hashmap_iter_next(iter);