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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramsay Jones committed Feb 2, 2012 at 04:59 UTC 173223aa62519033e547937c692f5540f59d9025
1 file changed +7 -7
vcs-svn/sliding_window.c
+7 -7
@@ -31,15 +31,15 @@ static int read_to_fill_or_whine(struct line_buffer *file,
31 return 0;
32 }
33
34 -static int check_overflow(off_t a, size_t b)
34 +static int check_offset_overflow(off_t offset, size_t len)
35 {
36 - if (b > maximum_signed_value_of_type(off_t))
36 + if (len > maximum_signed_value_of_type(off_t))
37 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))
40 return error("unrepresentable offset in delta: "
41 "%"PRIuMAX" + %"PRIuMAX" > OFF_MAX",
42 - (uintmax_t) a, (uintmax_t) b);
42 + (uintmax_t) offset, (uintmax_t) len);
43 return 0;
44 }
45
@@ -48,9 +48,9 @@ int move_window(struct sliding_view *view, off_t off, size_t width)
48 off_t file_offset;
49 assert(view);
50 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));
52
53 - if (check_overflow(off, width))
53 + if (check_offset_overflow(off, width))
54 return -1;
55 if (off < view->off || off + width < view->off + view->width)
56 return error("invalid delta: window slides left");