> On 30 Aug 2016, at 07:15, Dirk Hohndel <[email protected]> wrote:
> 
> On Mon, Aug 29, 2016 at 09:35:05PM +0200, Joakim Bygdell wrote:
>> +    QStringList cylinders;
>> +    struct dive *d;
>> +    int i = 0;
>> +    for_each_dive (i, d) {
>> +            for (int j = 0; j < MAX_CYLINDERS; j++) {
>> +                    QString cyl = d->cylinder[j].type.description;
>> +                    if (cyl == EMPTY_DIVE_STRING)
>> +                            continue;
>> +                    cylinders << cyl;
>> +            }
>> +    }
>> +
>> +    for (i = 0; i < 100 && tank_info[i].name != NULL; i++) {
> 
> Why are we looping to 100 here. That just seems odd to me.

Ask the original author, that loop is from equipment.c.
The definition of tank_info in equipment.c looks like this: "struct tank_info_t 
tank_info[100]"

> 
>> +    // info for first cylinder
>> +    if (myDive->getCylinder() != cylinder) {
>> +            diveChanged = true;
>> +            int i, size, wp;
>> +            for (i = 0; i < 100 && tank_info[i].name != NULL; i++) {
> 
> Again this loop to 100
> 
>> +                    if (tank_info[i].name == cylinder ) {
>> +                            if (tank_info[i].ml > 0){
>> +                                    size = tank_info[i].ml;
>> +                                    wp = tank_info[i].bar * 1000;
>> +                            }
>> +                            else {
> 
> That's not our coding style... } else {
My bad, I’ll fix that.

> 
> /D

/Jocke

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to