
On Wed, Nov 21, 2012 at 09:30:02AM +0100, Michal Privoznik wrote:
On 20.11.2012 19:51, Zeeshan Ali (Khattak) wrote: The latter one has been already checked as can be seen in context of the last chunk. The first one should not fail since it is us who inserted the value into volume->priv->vol;
Imo it's good to check that things are consistant with whatever assumptions have to be true, if the hash gets corrupted somehow, we'll at least get a warning that things are not in order. Most arguments to public/semi-public APIs are sanity-checked this way.
But assuming this function may be used somewhere else in the future these checks are actually correct - maybe my assumptions won't last then. Moreover, it doesn't hurt to check when playing around, right?
Well, it hurts in the sense that it has a runtime cost, which can be non-negligible when these checks are run in a tight loop, but I don't think these specific functions will be called that often. Christophe