[PATCH 2/2] Use get_dive to populate divelistview with dives

Linus Torvalds torvalds at linux-foundation.org
Thu Apr 18 07:32:28 PDT 2013


On Thu, Apr 18, 2013 at 12:59 AM,  <amit.k.chaudhuri at gmail.com> wrote:
>
> Add dives from dive_table to the model/view using the functions provided
> to extract the dives.

You could also use our helpers to actually walk the dives..

> +               int count = dive_table.nr;
> +               for( int i = 0 ; i < count; ++i){
> +                       d = get_dive(i);

This is basically

    for_each_dive(i, dive) {
        ...
    }

which is slightly more readable (and makes it easier in the future if
we change some of the dive_table details, like possibly making it a
sorted list instead of an array etc)..

               Linus


More information about the subsurface mailing list