and simplify it to use a for loop instead of a while loop
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3674
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
- Unconditionally blank the statusbar as soon as we're finished
getting input. (DLR, suggested by Benno Schulenberg)
- utils.c:
+ digits()
+ - Return the proper number of digits when n is exactly 10. (DLR)
+ - Simplify to use a for loop instead of a while loop. (DLR)
ngetdelim()
- Set errno to EINVAL if stream is not a valid file stream.
This matches the manual page. (DLR)
/* Return the number of decimal digits in n. */
int digits(size_t n)
{
- int i = 1;
+ int i;
- while (n > 10) {
- n /= 10;
- i++;
- }
+ for (i = 1; n >= 10; n /= 10, i++)
+ ;
return i;
}