On 25 November 2015 at 20:48, K. "pestophagous" Heller <[email protected]> wrote: > On Wed, Nov 25, 2015 at 10:38 AM, Lubomir I. Ivanov <[email protected]> > wrote: >>> + if (idx < 0) >>> + // convert an idx of -1 so we do insert-at-end: >>> + idx = dive_table.nr - 1; >> >> forgot to mention that in the above assignment dive_table.nr needs to >> be > 0, otherwise a negative index will remain. >> > > unless other code misuses dive_table, then i think we need not worry. > yet. (but i do love adding assertions...) > > note that this line happens first: > dive_table.nr++ > > so by the time the new code computes (dive_table.nr - 1), > dive_table.nr should be at least 1 by then. right?
yeah, so i neglected the ++ line. it seems OK to have the assignment after that. lubomir -- _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
