On Mon, May 12, 2014 at 04:10:05PM -0300, Tomaz Canabrava wrote: > From 8a517fcd926a7ecb8d2ef8afb91da766f591b876 Mon Sep 17 00:00:00 2001 > From: Tomaz Canabrava <[email protected]> > Date: Mon, 12 May 2014 14:22:46 -0300 > Subject: [PATCH 4/5] Renomed getDiveById to get_dive_by_id to keep current c > code organized. > > This commit renames getDiveById to get_dive_by_id, and it also removes > the Q_ASSERTS and if(!dive) return that the callers of this function > were calling. if it has a Q_ASSERT this means that the dive must exist, > so checking for nullness was bogus too. I'v changed the assert ( done > in a silly C-Way, someone that understands a bit more of C should try > to fix it for me ) to the function call to simplify code.
So I changed the silly C version of Q_ASSERT to at least tell us what the offending id was and to print to stderr. But I'm not sure I agree with you on removing the if (!dive) checks - if compiled without DEBUG this means we will dereference NULL pointers if for some reason there's a stale id somewhere. I would have to go back through the commit history to figure out if these were spots were this could conceivably happen - but in general I'm not sure I like the idea that we simply crash if we get an unexpected error somewhere. I'd rather figure out ways to keep going (which is what the old code did). Can you comment on that, Tomaz? I took the patch and just pushed it - so we may have to go in and add the null-ness checks back in. /D _______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
