Skip to content

Commit ab20794

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge branch 'size-t/commit'
2 parents 80161a4 + 6f30ad2 commit ab20794

4 files changed

Lines changed: 19 additions & 14 deletions

File tree

builtin/replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
459459
struct commit *commit;
460460
struct strbuf buf = STRBUF_INIT;
461461
const char *buffer;
462-
unsigned long size;
462+
size_t size;
463463

464464
if (repo_get_oid(the_repository, old_ref, &old_oid) < 0)
465465
return error(_("not a valid object name: '%s'"), old_ref);

builtin/stash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ static int write_commit_with_parents(struct repository *r,
20832083
const char *orig_author, *orig_committer;
20842084
char *author = NULL, *committer = NULL;
20852085
const char *buffer;
2086-
unsigned long bufsize;
2086+
size_t bufsize;
20872087
const char *p;
20882088
struct strbuf msg = STRBUF_INIT;
20892089
int ret = 0;
@@ -2135,7 +2135,7 @@ static int do_import_stash(struct repository *r, const char *rev)
21352135
struct object_id chain;
21362136
int res = 0;
21372137
const char *buffer = NULL;
2138-
unsigned long bufsize;
2138+
size_t bufsize;
21392139
struct commit *this = NULL;
21402140
struct commit_list *items = NULL, *cur;
21412141
char *msg = NULL;

commit.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
349349

350350
struct commit_buffer {
351351
void *buffer;
352-
unsigned long size;
352+
size_t size;
353353
};
354354
define_commit_slab(buffer_slab, struct commit_buffer);
355355

@@ -366,15 +366,18 @@ void free_commit_buffer_slab(struct buffer_slab *bs)
366366
free(bs);
367367
}
368368

369-
void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer, unsigned long size)
369+
void set_commit_buffer(struct repository *r, struct commit *commit,
370+
void *buffer, size_t size)
370371
{
371372
struct commit_buffer *v = buffer_slab_at(
372373
r->parsed_objects->buffer_slab, commit);
373374
v->buffer = buffer;
374375
v->size = size;
375376
}
376377

377-
const void *get_cached_commit_buffer(struct repository *r, const struct commit *commit, unsigned long *sizep)
378+
const void *get_cached_commit_buffer(struct repository *r,
379+
const struct commit *commit,
380+
size_t *sizep)
378381
{
379382
struct commit_buffer *v = buffer_slab_peek(
380383
r->parsed_objects->buffer_slab, commit);
@@ -390,7 +393,7 @@ const void *get_cached_commit_buffer(struct repository *r, const struct commit *
390393

391394
const void *repo_get_commit_buffer(struct repository *r,
392395
const struct commit *commit,
393-
unsigned long *sizep)
396+
size_t *sizep)
394397
{
395398
const void *ret = get_cached_commit_buffer(r, commit, sizep);
396399
if (!ret) {
@@ -404,7 +407,7 @@ const void *repo_get_commit_buffer(struct repository *r,
404407
die("expected commit for %s, got %s",
405408
oid_to_hex(&commit->object.oid), type_name(type));
406409
if (sizep)
407-
*sizep = cast_size_t_to_ulong(size);
410+
*sizep = size;
408411
}
409412
return ret;
410413
}
@@ -1185,7 +1188,7 @@ int parse_signed_commit(const struct commit *commit,
11851188
struct strbuf *payload, struct strbuf *signature,
11861189
const struct git_hash_algo *algop)
11871190
{
1188-
unsigned long size;
1191+
size_t size;
11891192
const char *buffer = repo_get_commit_buffer(the_repository, commit,
11901193
&size);
11911194
int ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);
@@ -1358,7 +1361,7 @@ int verify_commit_buffer(const char *buffer, size_t size,
13581361

13591362
int check_commit_signature(const struct commit *commit, struct signature_check *sigc)
13601363
{
1361-
unsigned long size;
1364+
size_t size;
13621365
const char *buffer = repo_get_commit_buffer(the_repository, commit, &size);
13631366
int ret = verify_commit_buffer(buffer, size, sigc);
13641367

@@ -1455,7 +1458,7 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit,
14551458
const char **exclude)
14561459
{
14571460
struct commit_extra_header *extra = NULL;
1458-
unsigned long size;
1461+
size_t size;
14591462
const char *buffer = repo_get_commit_buffer(the_repository, commit,
14601463
&size);
14611464
extra = read_commit_extra_header_lines(buffer, size, exclude);

commit.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,15 @@ void free_commit_buffer_slab(struct buffer_slab *bs);
131131
* Associate an object buffer with the commit. The ownership of the
132132
* memory is handed over to the commit, and must be free()-able.
133133
*/
134-
void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsigned long size);
134+
void set_commit_buffer(struct repository *r, struct commit *,
135+
void *buffer, size_t size);
135136

136137
/*
137138
* Get any cached object buffer associated with the commit. Returns NULL
138139
* if none. The resulting memory should not be freed.
139140
*/
140-
const void *get_cached_commit_buffer(struct repository *, const struct commit *, unsigned long *size);
141+
const void *get_cached_commit_buffer(struct repository *,
142+
const struct commit *, size_t *size);
141143

142144
/*
143145
* Get the commit's object contents, either from cache or by reading the object
@@ -146,7 +148,7 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,
146148
*/
147149
const void *repo_get_commit_buffer(struct repository *r,
148150
const struct commit *,
149-
unsigned long *size);
151+
size_t *size);
150152

151153
/*
152154
* Tell the commit subsystem that we are done with a particular commit buffer.

0 commit comments

Comments
 (0)