[GRASS-dev] adding units and vertical datum metadata to raster maps

Glynn Clements glynn at gclements.plus.com
Fri May 18 14:03:42 EDT 2007


Glynn Clements wrote:

> > TODO: create a fn in r.info to take care of G_asprint() work, right now
> > the "fancy output" section of the module is an ugly mess.
> >  [non-functional code, due to me being lost WRT passing pointers]
> > 
> > /*
> >         if (G_asprintf(&line, "Location: %s", G_location()) > 0)
> >             printline(line);
> >         else
> >             G_fatal_error(_("Cannot allocate memory for string"));
> > */
> >         compose_line( &line, "Location: %s", G_location() );
> >         printline(line);
> > ....
> > 
> > void compose_line(char *line, const char *fmt, ...)
> > {
> >     va_list ap;
> > 
> >     line = NULL;
> >     va_start(ap, fmt);
> > 
> >     if( G_asprintf(line, fmt, ap) <= 0 )
> 
> This won't work; we need a G_vasprintf() function which takes a
> va_list.

I've added G_vasprintf().

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




More information about the grass-dev mailing list