Skip to content

Commit 7cfaa86

Browse files
committed
Merge branch 'cb/many-alternate-optim-fixup'
Build fix. * cb/many-alternate-optim-fixup: object-file: use unsigned arithmetic with bit mask object-store: avoid extra ';' from KHASH_INIT oidtree: avoid nested struct oidtree_node
2 parents 2d755df + 581a3bb commit 7cfaa86

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

object-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2474,7 +2474,7 @@ struct oidtree *odb_loose_cache(struct object_directory *odb,
24742474
struct strbuf buf = STRBUF_INIT;
24752475
size_t word_bits = bitsizeof(odb->loose_objects_subdir_seen[0]);
24762476
size_t word_index = subdir_nr / word_bits;
2477-
size_t mask = 1 << (subdir_nr % word_bits);
2477+
size_t mask = 1u << (subdir_nr % word_bits);
24782478
uint32_t *bitmap;
24792479

24802480
if (subdir_nr < 0 ||

object-store.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct object_directory {
3434
};
3535

3636
KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
37-
struct object_directory *, 1, fspathhash, fspatheq);
37+
struct object_directory *, 1, fspathhash, fspatheq)
3838

3939
void prepare_alt_odb(struct repository *r);
4040
char *compute_alternate_path(const char *path, struct strbuf *err);

oidtree.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
#include "alloc.h"
77
#include "hash.h"
88

9-
struct oidtree_node {
10-
/* n.k[] is used to store "struct object_id" */
11-
struct cb_node n;
12-
};
13-
149
struct oidtree_iter_data {
1510
oidtree_iter fn;
1611
void *arg;
@@ -35,21 +30,21 @@ void oidtree_clear(struct oidtree *ot)
3530

3631
void oidtree_insert(struct oidtree *ot, const struct object_id *oid)
3732
{
38-
struct oidtree_node *on;
33+
struct cb_node *on;
3934

4035
if (!oid->algo)
4136
BUG("oidtree_insert requires oid->algo");
4237

4338
on = mem_pool_alloc(&ot->mem_pool, sizeof(*on) + sizeof(*oid));
44-
oidcpy_with_padding((struct object_id *)on->n.k, oid);
39+
oidcpy_with_padding((struct object_id *)on->k, oid);
4540

4641
/*
4742
* n.b. Current callers won't get us duplicates, here. If a
4843
* future caller causes duplicates, there'll be a a small leak
4944
* that won't be freed until oidtree_clear. Currently it's not
5045
* worth maintaining a free list
5146
*/
52-
cb_insert(&ot->tree, &on->n, sizeof(*oid));
47+
cb_insert(&ot->tree, on, sizeof(*oid));
5348
}
5449

5550

0 commit comments

Comments
 (0)