Skip to content

Commit 173223a

Browse files
Ramsay Jonesgitster
authored andcommitted
vcs-svn: rename check_overflow arguments for clarity
Code using the argument names a and b just doesn't look right (not sure why!). Use more explicit names "offset" and "len" to make their type and meaning clearer. Also rename check_overflow() to check_offset_overflow() to clarify that we are making sure that "len" bytes beyond "offset" still fits the type to represent an offset. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 58ebd98 commit 173223a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

vcs-svn/sliding_window.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ static int read_to_fill_or_whine(struct line_buffer *file,
3131
return 0;
3232
}
3333

34-
static int check_overflow(off_t a, size_t b)
34+
static int check_offset_overflow(off_t offset, size_t len)
3535
{
36-
if (b > maximum_signed_value_of_type(off_t))
36+
if (len > maximum_signed_value_of_type(off_t))
3737
return error("unrepresentable length in delta: "
38-
"%"PRIuMAX" > OFF_MAX", (uintmax_t) b);
39-
if (signed_add_overflows(a, (off_t) b))
38+
"%"PRIuMAX" > OFF_MAX", (uintmax_t) len);
39+
if (signed_add_overflows(offset, (off_t) len))
4040
return error("unrepresentable offset in delta: "
4141
"%"PRIuMAX" + %"PRIuMAX" > OFF_MAX",
42-
(uintmax_t) a, (uintmax_t) b);
42+
(uintmax_t) offset, (uintmax_t) len);
4343
return 0;
4444
}
4545

@@ -48,9 +48,9 @@ int move_window(struct sliding_view *view, off_t off, size_t width)
4848
off_t file_offset;
4949
assert(view);
5050
assert(view->width <= view->buf.len);
51-
assert(!check_overflow(view->off, view->buf.len));
51+
assert(!check_offset_overflow(view->off, view->buf.len));
5252

53-
if (check_overflow(off, width))
53+
if (check_offset_overflow(off, width))
5454
return -1;
5555
if (off < view->off || off + width < view->off + view->width)
5656
return error("invalid delta: window slides left");

0 commit comments

Comments
 (0)