inpcom.c, inp_get_param_level(), rewrite for readability
This commit is contained in:
parent
fefa690714
commit
505a4112a7
|
|
@ -3517,28 +3517,27 @@ struct dependency
|
|||
static int
|
||||
inp_get_param_level(int param_num, struct dependency *deps, int total_params)
|
||||
{
|
||||
int index1 = 0, comp_level = 0, temp_level = 0;
|
||||
int index2 = 0;
|
||||
int index1, comp_level = 0, temp_level;
|
||||
int index2;
|
||||
|
||||
if (deps[param_num].level != -1)
|
||||
return deps[param_num].level;
|
||||
|
||||
while (deps[param_num].depends_on[index1] != NULL) {
|
||||
index2 = 0;
|
||||
while (index2 < total_params &&
|
||||
deps[index2].param_name != deps[param_num].depends_on[index1])
|
||||
index2++;
|
||||
for (index1 = 0; deps[param_num].depends_on[index1]; index1++) {
|
||||
|
||||
for (index2 = 0; index2 < total_params; index2++)
|
||||
if (deps[param_num].depends_on[index1] == deps[index2].param_name)
|
||||
break;
|
||||
|
||||
if (index2 >= total_params) {
|
||||
fprintf(stderr, "ERROR: unable to find dependency parameter for %s!\n", deps[param_num].param_name);
|
||||
controlled_exit(EXIT_FAILURE);
|
||||
}
|
||||
temp_level = inp_get_param_level(index2, deps, total_params);
|
||||
temp_level++;
|
||||
|
||||
temp_level = inp_get_param_level(index2, deps, total_params) + 1;
|
||||
|
||||
if (comp_level < temp_level)
|
||||
comp_level = temp_level;
|
||||
index1++;
|
||||
}
|
||||
|
||||
deps[param_num].level = comp_level;
|
||||
|
|
|
|||
Loading…
Reference in New Issue