Skip to content

Commit 5512347

Browse files
dschoGit for Windows Build Agent
authored andcommitted
pack-objects: drop the two tree-walk casts in the preferred-base path
With init_tree_desc() widened in the prior commit, the size_t-returning odb_read_object_peeled() call in add_preferred_base() and odb_read_object() call in pbase_tree_get() can both flow straight through to init_tree_desc() and into the pbase_tree_cache. Widen pbase_tree_cache.tree_size and the two local size variables to size_t, drop the size_st bridges, and drop the two cast_size_t_to_ulong() shims. This was the last pair of cast_size_t_to_ulong() call sites in builtin/pack-objects.c, completing the >4 GiB-objects work in that file that this branch and its predecessors have been pursuing. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent bd4dc27 commit 5512347

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

builtin/pack-objects.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,7 @@ struct pbase_tree_cache {
19191919
int ref;
19201920
int temporary;
19211921
void *tree_data;
1922-
unsigned long tree_size;
1922+
size_t tree_size;
19231923
};
19241924

19251925
static struct pbase_tree_cache *(pbase_tree_cache[256]);
@@ -1946,8 +1946,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
19461946
{
19471947
struct pbase_tree_cache *ent, *nent;
19481948
void *data;
1949-
unsigned long size;
1950-
size_t size_st = 0;
1949+
size_t size;
19511950
enum object_type type;
19521951
int neigh;
19531952
int my_ix = pbase_tree_cache_ix(oid);
@@ -1975,8 +1974,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
19751974
/* Did not find one. Either we got a bogus request or
19761975
* we need to read and perhaps cache.
19771976
*/
1978-
data = odb_read_object(the_repository->objects, oid, &type, &size_st);
1979-
size = cast_size_t_to_ulong(size_st);
1977+
data = odb_read_object(the_repository->objects, oid, &type, &size);
19801978
if (!data)
19811979
return NULL;
19821980
if (type != OBJ_TREE) {
@@ -2130,16 +2128,14 @@ static void add_preferred_base(struct object_id *oid)
21302128
{
21312129
struct pbase_tree *it;
21322130
void *data;
2133-
unsigned long size;
2134-
size_t size_st = 0;
2131+
size_t size;
21352132
struct object_id tree_oid;
21362133

21372134
if (window <= num_preferred_base++)
21382135
return;
21392136

21402137
data = odb_read_object_peeled(the_repository->objects, oid,
2141-
OBJ_TREE, &size_st, &tree_oid);
2142-
size = cast_size_t_to_ulong(size_st);
2138+
OBJ_TREE, &size, &tree_oid);
21432139
if (!data)
21442140
return;
21452141

0 commit comments

Comments
 (0)