Re: [ng-spice] A small bugfix for rework 11
On Tue, May 30, 2000 at 07:52:01PM +0200, Manfred Metzger wrote:
> "Arno W. Peters" wrote:
>
> > Applied along with a total elimination of MALLOC() by using
> > asprintf().
>
> Do you think it is a good idea to use such a non-standard function
> like asprintf()? I think it is not necessary in this case but makes porting
> to other systems harder. For example i have a HP 9000 Workstation
> which does not provide asprintf(). Yes, i have read the portability page
> on the ng-spice homepage but ...
Yes, for the following reasons:
1) asprinf() is available in C libraries on GNU and BSD systems and
thus standard and documented on those platforms.
2) asprinf() relieves the programmer from calculating the size of the
memory allocation for printing strings. This is a Good Thing.
2) configure can check for asprinf() and define a macro
HAVE_ASPRINTF. In case the function is not available, you are free to
add the function to the misc directory and enclose the whole function
with
#ifndef HAVE_ASPRINTF
int
asprintf(char **strp, const char *format, ...)
{
/* Code copied (for example) from the FreeBSD C library */
}
#endif
I will accept patches that implement this function for ngspice and
integrate it into the archive.
I hope that answers your question.
Greetings,
--
Arno
PGP signature
Partial thread listing:
- Re: [ng-spice] A small bugfix for rework 11, (continued)
Another patch for rework-11
Manfred Metzger