bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xgethostbyname using realloc()


From: Jim Meyering
Subject: Re: [PATCH] xgethostbyname using realloc()
Date: Sat, 29 Aug 2009 08:51:37 +0200

Robert Millan wrote:
> This makes it easier to import xgethostname.c into an external program.

What's the motivation?  removing dependencies?

> 2009-08-29  Robert Millan  <address@hidden>
>
>       * lib/xgethostname.c: Remove `"xalloc.h"'.
>       (xgethostname): Use realloc() instead of x2realloc().
>
...
> -      hostname = x2realloc (hostname, &size);
> +      tmp = realloc (hostname, size);
> +      if (! tmp)
> +     {
> +       perror ("realloc");
> +       exit (1);

You've removed an important bit of semantics here.
x2realloc increases SIZE as well as calling realloc.

Also, you've made it so upon failure it gives an
inferior diagnostic, using perror, rather than "error".




reply via email to

[Prev in Thread] Current Thread [Next in Thread]