mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
Remove useless 'maxReg' variable
It is used to break out of the loop early if one regex does not match. Use the 'break' statement instead.
This commit is contained in:
parent
220c0031fe
commit
f01f62d43d
@ -2782,7 +2782,6 @@ virCommandRunRegex(virCommandPtr cmd,
|
||||
int err;
|
||||
regex_t *reg;
|
||||
regmatch_t *vars = NULL;
|
||||
int maxReg = 0;
|
||||
size_t i, j, k;
|
||||
int totgroups = 0, ngroup = 0, maxvars = 0;
|
||||
char **groups;
|
||||
@ -2841,9 +2840,9 @@ virCommandRunRegex(virCommandPtr cmd,
|
||||
if (!p)
|
||||
p = lines[k];
|
||||
|
||||
for (i = 0; i <= maxReg && i < nregex; i++) {
|
||||
if (regexec(®[i], p, nvars[i]+1, vars, 0) == 0) {
|
||||
maxReg++;
|
||||
for (i = 0; i < nregex; i++) {
|
||||
if (regexec(®[i], p, nvars[i]+1, vars, 0) != 0)
|
||||
break;
|
||||
|
||||
if (i == 0)
|
||||
ngroup = 0;
|
||||
@ -2864,12 +2863,10 @@ virCommandRunRegex(virCommandPtr cmd,
|
||||
/* Release matches & restart to matching the first regex */
|
||||
for (j = 0; j < totgroups; j++)
|
||||
VIR_FREE(groups[j]);
|
||||
maxReg = 0;
|
||||
ngroup = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
|
Loading…
x
Reference in New Issue
Block a user