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

Amit Chaudhuri amit.k.chaudhuri at gmail.com
Thu Apr 18 07:47:18 PDT 2013


Oooh - handy!


On Thu, Apr 18, 2013 at 3:32 PM, Linus Torvalds <
torvalds at linux-foundation.org> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130418/7a044716/attachment.html>


More information about the subsurface mailing list