Skip to content

Commit 97a39a4

Browse files
newrengitster
authored andcommitted
hashmap: adjust spacing to fix argument alignment
No actual code changes; just whitespace adjustments. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6474b86 commit 97a39a4

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

hashmap.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,17 @@ static void alloc_table(struct hashmap *map, unsigned int size)
9292
}
9393

9494
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)
9798
{
9899
return (e1 == e2) ||
99100
(e1->hash == e2->hash &&
100101
!map->cmpfn(map->cmpfn_data, e1, e2, keydata));
101102
}
102103

103104
static inline unsigned int bucket(const struct hashmap *map,
104-
const struct hashmap_entry *key)
105+
const struct hashmap_entry *key)
105106
{
106107
return key->hash & (map->tablesize - 1);
107108
}
@@ -148,7 +149,7 @@ static int always_equal(const void *unused_cmp_data,
148149
}
149150

150151
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)
152153
{
153154
unsigned int size = HASHMAP_INITIAL_SIZE;
154155

@@ -199,7 +200,7 @@ struct hashmap_entry *hashmap_get(const struct hashmap *map,
199200
}
200201

201202
struct hashmap_entry *hashmap_get_next(const struct hashmap *map,
202-
const struct hashmap_entry *entry)
203+
const struct hashmap_entry *entry)
203204
{
204205
struct hashmap_entry *e = entry->next;
205206
for (; e; e = e->next)
@@ -225,8 +226,8 @@ void hashmap_add(struct hashmap *map, struct hashmap_entry *entry)
225226
}
226227

227228
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)
230231
{
231232
struct hashmap_entry *old;
232233
struct hashmap_entry **e = find_entry_ptr(map, key, keydata);
@@ -249,7 +250,7 @@ struct hashmap_entry *hashmap_remove(struct hashmap *map,
249250
}
250251

251252
struct hashmap_entry *hashmap_put(struct hashmap *map,
252-
struct hashmap_entry *entry)
253+
struct hashmap_entry *entry)
253254
{
254255
struct hashmap_entry *old = hashmap_remove(map, entry, NULL);
255256
hashmap_add(map, entry);

hashmap.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ struct hashmap {
228228
* prevent expensive resizing. If 0, the table is dynamically resized.
229229
*/
230230
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);
234234

235235
/* internal function for freeing hashmap */
236236
void hashmap_free_(struct hashmap *map, ssize_t offset);
@@ -288,7 +288,7 @@ void hashmap_free_(struct hashmap *map, ssize_t offset);
288288
* and if it is on stack, you can just let it go out of scope).
289289
*/
290290
static inline void hashmap_entry_init(struct hashmap_entry *e,
291-
unsigned int hash)
291+
unsigned int hash)
292292
{
293293
e->hash = hash;
294294
e->next = NULL;
@@ -330,8 +330,8 @@ static inline unsigned int hashmap_get_size(struct hashmap *map)
330330
* to `hashmap_cmp_fn` to decide whether the entry matches the key.
331331
*/
332332
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);
335335

336336
/*
337337
* 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(
364364
* call to `hashmap_get` or `hashmap_get_next`.
365365
*/
366366
struct hashmap_entry *hashmap_get_next(const struct hashmap *map,
367-
const struct hashmap_entry *entry);
367+
const struct hashmap_entry *entry);
368368

369369
/*
370370
* 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);
384384
* Returns the replaced entry, or NULL if not found (i.e. the entry was added).
385385
*/
386386
struct hashmap_entry *hashmap_put(struct hashmap *map,
387-
struct hashmap_entry *entry);
387+
struct hashmap_entry *entry);
388388

389389
/*
390390
* Adds or replaces a hashmap entry contained within @keyvar,
@@ -406,8 +406,8 @@ struct hashmap_entry *hashmap_put(struct hashmap *map,
406406
* Argument explanation is the same as in `hashmap_get`.
407407
*/
408408
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);
411411

412412
/*
413413
* Removes a hashmap entry contained within @keyvar,
@@ -449,7 +449,7 @@ struct hashmap_entry *hashmap_iter_next(struct hashmap_iter *iter);
449449

450450
/* Initializes the iterator and returns the first entry, if any. */
451451
static inline struct hashmap_entry *hashmap_iter_first(struct hashmap *map,
452-
struct hashmap_iter *iter)
452+
struct hashmap_iter *iter)
453453
{
454454
hashmap_iter_init(map, iter);
455455
return hashmap_iter_next(iter);

0 commit comments

Comments
 (0)