[rfc] asprintf() -> xasprintf()
Frank Ch. Eigler
fche@redhat.com
Tue Nov 14 08:01:00 GMT 2000
Fernando Nasser <fnasser@cygnus.com> writes:
: Good catch. No more memory would cause an attempt to free NULL.
: (Have you ever considered a FREE macro that tests for NULL pointers? [...]
free(NULL) is defined in even old standards to be a no-op.
: [...]
: > + void
: > + xvasprintf (char **ret, const char *format, va_list ap)
: > + {
: > + int status = vasprintf (ret, format, ap);
: > + if ((*ret) == NULL)
: > + internal_error ("%s:%d: vasprintf returned NULL buffer (errno %d)",
: > + __FILE__, __LINE__, errno);
: > + if (status < 0)
: > + internal_error ("%s:%d: vasprintf call failed (errno %d)",
: > + __FILE__, __LINE__, errno);
: > + }
Is __FILE__ and __LINE__ at all informative in these cases? These are
plain functions, not macros, so the same strings will be printed
regardless of the location of the caller.
- FChE
More information about the Gdb-patches
mailing list