Fix complaint about initial declaration in foor loop.

gcc-4.7.2 (Debian 4.7.2-5) complained about:
"‘for’ loop initial declarations are only allowed in C99 mode
note: use option -std=c99 or -std=gnu99 to compile your code"
when seeing a loop like
for(int i=0; i<end; ++i)

This is fixed by moving the declaration before the for loop with
this commit. Altenatively, we could use the above option.
This commit is contained in:
Markus Blatt 2015-09-03 13:55:52 +02:00
parent 1ec3a6065a
commit 4102846873
2 changed files with 4 additions and 2 deletions

View File

@ -364,7 +364,8 @@ well_controls_get_current_distr(const struct WellControls * ctrl) {
void
well_controls_iset_distr(const struct WellControls * ctrl, int control_index, const double * distr) {
int offset = control_index * ctrl->number_of_phases;
for (int p=0; p < ctrl->number_of_phases; p++)
int p;
for (p=0; p < ctrl->number_of_phases; p++)
ctrl->distr[offset + p] = distr[p];
}

View File

@ -544,7 +544,8 @@ wells_equal(const struct Wells *W1, const struct Wells *W2 , bool verbose)
return are_equal;
}
for (int i=0; i<W1->number_of_wells; i++) {
int i;
for (i=0; i<W1->number_of_wells; i++) {
if (are_equal) {
/*
The name attribute can be NULL. The comparison is as