[GRASS-dev] use G_find_raster2() instead of G_find_raster()

Glynn Clements glynn at gclements.plus.com
Fri Nov 1 15:45:03 PDT 2013


Vaclav Petras wrote:

> But I'm not able to decide on which occasion I want which function.
> Someday, I can try to call both functions with different map/mapset
> combinations but reading from manual would be more effective.

Please use G_find_raster2() always (similarly for the other G_find_*
functions). G_find_raster() exists for backward compatibility only. 
Having it modify the map name in-place has been the source of
countless bugs.

Note that the first argument to G_find_raster() is "char *", rather
than "const char *", so if you have a "const" string you must use
G_find_raster2().

Even if the string isn't explicitly declared "const", the fact that it
may be modified means that if you need to retain the original value,
you have to explicitly copy it.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list