Re: Missing asprintf()

2008-09-09 Thread Gisle Vanem

"Hrvoje Niksic" <[EMAIL PROTECTED]> wrote:


Wget is supposed to use aprintf, which is defined in utils.c, and is
not specific to Unix.

It's preferable to use an asprintf-like functions than a static buffer
because it supports reentrance (unlike a static buffer) and imposes no
arbitrary limits on error output.


Fine by me. Here is an adjusted patch:

--- hg-latest/src/url.c  Tue Sep 09 12:37:23 2008
+++ url.c   Tue Sep 09 14:37:39 2008
@@ -900,9 +900,9 @@
  if ((p = strchr (scheme, ':')))
*p = '\0';
  if (!strcasecmp (scheme, "https"))
-asprintf (&error, _("HTTPS support not compiled in"));
+error = aprintf (_("HTTPS support not compiled in"));
  else
-asprintf (&error, _(parse_errors[error_code]), quote (scheme));
+error =aprintf (_(parse_errors[error_code]), quote (scheme));
  xfree (scheme);

  return error;

-

--gv


Re: Missing asprintf()

2008-09-09 Thread Hrvoje Niksic
Gisle Vanem <[EMAIL PROTECTED]> writes:

> Why the need for asprintf() in url.c:903? This function is missing
> on DOS/Win32 and nowhere to be found in ./lib.

Wget is supposed to use aprintf, which is defined in utils.c, and is
not specific to Unix.

It's preferable to use an asprintf-like functions than a static buffer
because it supports reentrance (unlike a static buffer) and imposes no
arbitrary limits on error output.