Skip to content

Commit d3298aa

Browse files
dschoGit for Windows Build Agent
authored andcommitted
blame: widen struct blame_scoreboard.final_buf_size to size_t
Continue the size_t evacuation. final_buf_size is fed either from textconv_object()'s now-size_t out-parameter, from odb_read_object()'s size_t out-parameter (both bridged today through a final_buf_size_st local + cast_size_t_to_ulong()), or from o->file.size (mmfile_t, long). Widen the struct field, point both producers straight at it, and drop the bridge variable along with the cast. builtin/blame.c only reads the field for pointer arithmetic and comparisons, which promote cleanly. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent dc95cbe commit d3298aa

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

blame.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,20 +2861,18 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28612861
sb->final_buf_size = o->file.size;
28622862
}
28632863
else {
2864-
size_t final_buf_size_st = 0;
28652864
o = get_origin(sb->final, sb->path);
28662865
if (fill_blob_sha1_and_mode(sb->repo, o))
28672866
die(_("no such path %s in %s"), sb->path, final_commit_name);
28682867

28692868
if (sb->revs->diffopt.flags.allow_textconv &&
28702869
textconv_object(sb->repo, sb->path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
2871-
&final_buf_size_st))
2870+
&sb->final_buf_size))
28722871
;
28732872
else
28742873
sb->final_buf = odb_read_object(the_repository->objects,
28752874
&o->blob_oid, &type,
2876-
&final_buf_size_st);
2877-
sb->final_buf_size = cast_size_t_to_ulong(final_buf_size_st);
2875+
&sb->final_buf_size);
28782876

28792877
if (!sb->final_buf)
28802878
die(_("cannot read blob %s for path %s"),

blame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct blame_scoreboard {
117117
* indexed with scoreboard.lineno[blame_entry.lno].
118118
*/
119119
char *final_buf;
120-
unsigned long final_buf_size;
120+
size_t final_buf_size;
121121

122122
/* linked list of blames */
123123
struct blame_entry *ent;

0 commit comments

Comments
 (0)