do {
char line[1024];
char *start;
- char **tokens;
- size_t ntokens;
- size_t i;
+ g_auto(GStrv) tokens = NULL;
+ GStrv next;
if (!fgets(line, sizeof(line), fp))
break;
/* Split the line using " " as a delimiter. The first token
* will always be ":", but that's okay */
- if (!(tokens = virStringSplitCount(start, " ", 0, &ntokens)))
+ if (!(tokens = g_strsplit(start, " ", 0)))
continue;
/* Go through all flags and check whether one of those we
* might want to check for later on is present; if that's
* the case, set the relevant bit in the bitmap */
- for (i = 0; i < ntokens; i++) {
+ for (next = tokens; *next; next++) {
int value;
- if ((value = virHostValidateCPUFlagTypeFromString(tokens[i])) >= 0)
+ if ((value = virHostValidateCPUFlagTypeFromString(*next)) >= 0)
ignore_value(virBitmapSetBit(flags, value));
}
-
- virStringListFreeCount(tokens, ntokens);
} while (1);
VIR_FORCE_FCLOSE(fp);