Skip to content

Commit

Permalink
sam: simplify boolean expression, start < end implies end > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Nov 13, 2020
1 parent 2a4edf9 commit f95cf94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ static Filerange address_line_evaluate(Address *addr, File *file, Filerange *ran
size_t start = range->start, end = range->end, line;
if (sign > 0) {
char c;
if (start < end && end > 0 && text_byte_get(txt, end-1, &c) && c == '\n')
if (start < end && text_byte_get(txt, end-1, &c) && c == '\n')
end--;
line = text_lineno_by_pos(txt, end);
line = text_pos_by_lineno(txt, line + offset);
Expand Down

0 comments on commit f95cf94

Please sign in to comment.