Merge pull request #869 from blattms/fix-for-loop-initial-decl

Fix complaint about initial declaration in foor loops.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-09-04 14:10:46 +02:00
commit c042a1912a
3 changed files with 6 additions and 4 deletions

View File

@ -14,8 +14,8 @@ int memcmp_double(const double * p1 , const double *p2 , size_t num_elements) {
else {
const double abs_epsilon = 1e-8;
const double rel_epsilon = 1e-5;
for (size_t index = 0; index < num_elements; index++) {
size_t index;
for (index = 0; index < num_elements; index++) {
double diff = fabs(p1[index] - p2[index]);
if (diff > abs_epsilon) {
double sum = fabs(p1[index]) + fabs(p2[index]);

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