Skip to content

Commit

Permalink
Applications/util/less.c: replace for (int i ... with for (i ....
Browse files Browse the repository at this point in the history
  • Loading branch information
Warren Toomey committed Jan 23, 2025
1 parent 949d380 commit 195eda3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Applications/util/less.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,13 @@ void paint_screen(struct lineposn *this) {

/* Reposition the current view of the file */
struct lineposn *reposition(struct lineposn *this, int count) {
int i;
struct lineposn *last;

if (count == 0) return (this);

if (count > 0)
for (int i = 0; i < count; i++) {
for (i = 0; i < count; i++) {
/* Get more offsets if we don't have any */
if (this->next == NULL) append_offsets(this, count - i);
last = this; this = this->next;
Expand All @@ -360,7 +361,7 @@ struct lineposn *reposition(struct lineposn *this, int count) {
}
} else {
count = -count;
for (int i = 0; i < count; i++) {
for (i = 0; i < count; i++) {
last = this; this = this->prev;
if (this == NULL) { /* Too far, go forward a line */
this = last; break;
Expand Down

0 comments on commit 195eda3

Please sign in to comment.