[GRASS-dev] should G_raster_map_type() use G_find_cell2() ?

Hamish hamish_nospam at yahoo.com
Thu Oct 26 23:39:03 EDT 2006

Hamish wrote:
> > G_raster_map_type() calls G_find_cell(), which chops off the
> > @othermapset part of a map's name.
> > 
> > should it call G_find_cell2(), which leaves the map name alone?

Glynn wrote:
> Maybe, but you would need to examine everything which uses
> G_raster_map_type() (71 files) in case something expects this
> behaviour.

That sounds dangerous. I've added a new fn called G_raster_map_type2()
which checks the map type in a non-name modifying way. (akin to
G_find_cell2(), G_find_vector2(), G_find_file2(): these already exist
for the same reason)

> The quick solution is to pass the name/mapset returned from
> G_find_file() rather than the original qualified name.

map existence and type are checked in two separate functions; *mapset
is never returned to main(). The "@mapset" was getting clobbered in
both. Testing a copy of the string seems highly inefficient.


More information about the grass-dev mailing list