Skip to content

Commit

Permalink
(mcview_eol): refactor, fix coding style.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Borodin <[email protected]>
  • Loading branch information
aborodin committed Dec 15, 2024
1 parent b5610b2 commit 6de5e62
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/viewer/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,27 +354,25 @@ mcview_bol (WView *view, off_t current, off_t limit)
off_t
mcview_eol (WView *view, off_t current)
{
int c, prev_ch = 0;
int c;
int prev_ch = 0;

if (current < 0)
return 0;

while (TRUE)
for (; mcview_get_byte (view, current, &c); current++)
{
if (!mcview_get_byte (view, current, &c))
break;
if (c == '\n')
{
current++;
break;
}
else if (prev_ch == '\r')
{
if (prev_ch == '\r')
break;
}
current++;

prev_ch = c;
}

return current;
}

Expand Down

0 comments on commit 6de5e62

Please sign in to comment.