[GRASS5] PATCH: asprintf.c

Brad Douglas rez at touchofmadness.com
Wed Jun 8 21:55:17 EDT 2005


On Thu, 2005-06-09 at 01:52 +0100, Paul Kelly wrote:
> Hello Brad
> 
> On Wed, 8 Jun 2005, Brad Douglas wrote:
> 
> > I updated asprintf.c to cannibalize the GIS API, using G_tempfile().
> >
> > Objections?
> 
> It may be a bit slower but probably not much if at all. It is clearer what 
> it is doing and more consistent with usage in other GRASS modules anyway.
> 
> Previous correspondence on the list has indicated that in all C
> implementations we can rely on the size of a char being 1 byte so it is
> more efficient not to use the sizeof() function.

I used sizeof(char) because size_t varies across architectures and it
quiets the compiler without any loss in performance.  sizeof() is a
macro and is determined before the binary is generated, so there is
absolutely no loss in performance (I verified the asm output to be
identical in GCC).

> It would be nice also to use indent according to the spec in the 
> SUBMITTING document to format the file nicely, as I left it in a total 
> mess when originally submitting it.

I had planned on reformatting the function after the working parts had
been committed.


-- 
Brad Douglas <rez at touchofmadness.com>




More information about the grass-dev mailing list