mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
newfs: prefer unsigned index over signed
We can just use a for loop starting at 0 instead of a while loop starting at -1. Reviewed by: imp, mckusick Pull Request: https://github.com/freebsd/freebsd-src/pull/733
This commit is contained in:
parent
31b3e4f1b4
commit
430168942f
|
@ -137,7 +137,8 @@ main(int argc, char *argv[])
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *cp, *special;
|
char *cp, *special;
|
||||||
intmax_t reserved;
|
intmax_t reserved;
|
||||||
int ch, i, rval;
|
int ch, rval;
|
||||||
|
size_t i;
|
||||||
char part_name; /* partition name, default to full disk */
|
char part_name; /* partition name, default to full disk */
|
||||||
|
|
||||||
part_name = 'c';
|
part_name = 'c';
|
||||||
|
@ -153,9 +154,10 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
volumelabel = optarg;
|
volumelabel = optarg;
|
||||||
i = -1;
|
for (i = 0; isalnum(volumelabel[i]) ||
|
||||||
while (isalnum(volumelabel[++i]) ||
|
volumelabel[i] == '_' || volumelabel[i] == '-';
|
||||||
volumelabel[i] == '_' || volumelabel[i] == '-');
|
i++)
|
||||||
|
continue;
|
||||||
if (volumelabel[i] != '\0') {
|
if (volumelabel[i] != '\0') {
|
||||||
errx(1, "bad volume label. Valid characters "
|
errx(1, "bad volume label. Valid characters "
|
||||||
"are alphanumerics, dashes, and underscores.");
|
"are alphanumerics, dashes, and underscores.");
|
||||||
|
|
Loading…
Reference in a new issue