[GRASS-dev] Can Rast_open_* call G_fatal_error()?
Glynn Clements
glynn at gclements.plus.com
Wed Dec 23 23:45:04 EST 2009
I wrote:
> The fix would be simpler if G_open_cell_old() called G_fatal_error() on
> errors. This would make life simpler for modules, which currently need to
> check the return value. Off the top of my head, I don't know of a single
> case where the caller actually tries to recover from G_open_cell_old()
> failing. Doing so would also be a benefit to a small number of modules
> which forget to check for errors.
Can anyone think of a reason *not* to implement this change in 7.0?
As it stands, just about every raster module does something like:
infd = Rast_open_old(name, "");
if (infd < 0)
G_fatal_error(_("Unable to open input map <%s>"), name);
It would be simpler for just about everything if Rast_open_old() just
called G_fatal_error() itself on errors.
I can't think of a single case where the caller does something other
than call G_fatal_error() if opening an input map fails (or output
map, for that); although I did spot a couple of cases (e.g.
v.vol.rst/user1.c) where the caller neglects to check the return
value.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list