On Tue, 12 Jul 2011 18:40:20 +0200 Uwe Hermann <[email protected]> wrote:
> On Fri, Jul 01, 2011 at 06:05:07AM +0200, Stefan Tauner wrote: > > compile tested only. > > btw... why dont we wrap malloc to automatically include these checks? > > there is probably a patch somewhere that adds totally awesome shutdown code > > in OOM cases, > > but afaics we just print a warning and exit right now... it is just stupid > > to do the checks in the real > > code then. > > > > Signed-off-by: Stefan Tauner <[email protected]> > > It's definately better than what we have now (no error checking at all), so: > > Acked-by: Uwe Hermann <[email protected]> thanks, r1370 > A few notes for later though: > > - We should call any shutdown function which may need to be called in > the respective places (and any free()s which may be needed). that would probably be handled by int programmer_shutdown(void) in flashrom.c at the moment. it should either be named differently or wrapped with a more generic function though(?) > - Later we should not exit(1) upon the error, but rather return an > error code instead (e.g. FL_ERR_MALLOC or similar), at least in all > public "API" functions which are meant to be in the upcoming > libflashrom. and in the internal ones? just as errors values? > - A small xmalloc() wrapper (or use another name) would indeed be nice, too, > but once we really return error codes etc. it's not really useful > anymore I think. that's true, at least as long as it is not a macro that automagically returns on errors (which would be super evil, but... well no "but" i guess. :) -- Kind regards/Mit freundlichen Grüßen, Stefan Tauner _______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
