[GRASS5] Problem compiling Grass51

Radim Blazek blazek at itc.it
Thu May 22 03:53:30 EDT 2003


On Wednesday 21 May 2003 09:32 pm, Glynn Clements wrote:
> Paul Kelly wrote:
> > > > I have added Eric's G_asprintf to 5.1 now as I tested it a bit and it
> > > > seemed to work best for me. So now it can get a bit more testing. I
> > > > didn't realise before but it needs to be used like:
> > > >
> > > > 	char *str;
> > > > 	G_asprintf( &str, "format etc..%s", otherstring);
> > >
> > > Is there any reason why it can't be changed to:
> > >
> > > 	str = G_asprintf("format etc..%s", otherstring);
> > >
> > > ?
> >
> > That is maybe better, more like G_store() (whose functionality is quite
> > similar). Maybe it could be called G_storef() then.
>
> I think that G_asprintf() is the right name.
>
> > Whatever you think. Is
> > the main reason for changing it that it's confusing the way it is?
>
> It just seems more natural. OTOH, the existing prototype matches
> asprintf(), so maybe it should be kept.

I think that it should be either called G_asprintf() and be compatible 
with asprintf(), i.e. int G_asprintf(char **strp, const char *fmt, ...)
or it could have different prototype, but different name should be used then.

To keep G_asprintf() matching asprintf() seems to be better.

Paul, do you intend to replace all snprintf() occurrences or should I do that?

Radim




More information about the grass-dev mailing list