Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

a little issue in memtest #859

Closed
erbenmo opened this Issue · 1 comment

2 participants

@erbenmo

in memtest.c, function memtest_progress_step (line 79)

for (j = 0; j < chars-progress_printed; j++) {
printf("%c",c);
progress_printed++;
}

I am not sure why we are incrementing progress_printed while progress_printed is also used in the for-loop predicate. I think the following should be enough:

for (j = 0; j < chars-progress_printed; j++) {
printf("%c",c);
}
progress_printed = chars

I tested both the old code and the new code on my machine and both seem work fine. It is interesting that the old code doesn't have a noticeable missing in output. I figured it might be because we are calling this function very frequently and the terminal window i have is not large enough.

@antirez
Owner

That's funny @erbenmo :-) Basically the code ends to be equivalent just for a strange interaction, that is, because we print less chars than required, the next iteration wants to print more. Even if it ends printing just the half characters, the next will try to print even more, and so forth, so the final effect is to print everything :-)

However this probably produced an "acceleration effect" in the output. Btw now it's fixed, thanks. Closing.

@antirez antirez closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.