This loop contains no `continue` statements, its counter is incremented in a
regular way, and the counter is unused outside the loop. So we can write the
loop more concisely and scope `ind` more tightly by using a `for` loop instead
of a `while` loop.
char line[BUFSIZ];
char *ss;
char *pch;
- int ind = 0;
int attrcount = 0;
static char *smyrna_attrs;
if (file != NULL) {
while (fgets(line, sizeof line, file) != NULL) {
pch = strtok(line, ",");
- ind = 0;
- while (pch != NULL) {
+ for (int ind = 0; pch != NULL; ++ind) {
ss = strdup(pch);
pch = strtok(NULL, ",");
switch (ind) {
attr[attrcount].ComboValuesCount++;
break;
}
- ind++;
}
attrcount++;
}