some similar functions

Dirk Hohndel dirk at hohndel.org
Sat Nov 16 16:56:08 UTC 2013


On Sat, 2013-11-16 at 19:16 -0200, Tomaz Canabrava wrote:
> int get_index_for_dive(struct dive *dive) {
>     int i;
>     struct dive *d;
>     for_each_dive(i, d)
>         if (d == dive)
>             return i;
>     return -1;
> }
> 
> int get_divenr(struct dive *dive)
> {
>     int divenr = -1;
>     while (++divenr < dive_table.nr && get_dive(divenr) != dive)
>         ;
>     return divenr;
> }
> 
> 
> Safe to remove one of them both?

Yes, funny we have two. I like the first one better :-)

/D




More information about the subsurface mailing list