bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 3/6] graphs: style: use left justification for states


From: Akim Demaille
Subject: Re: [PATCH 3/6] graphs: style: use left justification for states
Date: Thu, 11 Oct 2012 09:36:28 +0200

Hi Théophile,

Le 10 oct. 2012 à 19:14, Theophile Ranquet a écrit :

> +static char *escape_buffer = NULL;
> +
> +void
> +free_escape_buffer ()
> +{
> +  free (escape_buffer);
> +  escape_buffer = NULL;
> +}
> +
> +char const *
> +escape (char const *name)
> +{
> +  struct quoting_options *o = NULL;
> +  if (! o)
> +    {
> +      o = clone_quoting_options (NULL);
> +      set_quoting_style (o, escape_quoting_style);
> +      set_char_quoting (o, '"', 1);
> +    }
> +  escape_buffer = quotearg_alloc (name, strlen (name), o);
> +  return escape_buffer;
> +}

We already discussed about this, and really, I don't
like this.  The solution I promoted is _much_ simpler,
and safer too.  Yet, your proposal would be improved
if you'd call free_escape_buffer from escape itself,
to relieve the "regular" callers from having to do it.
Just leave the final clean call.

But then again, I prefer that you'd use quotearg's
buffers, not introducing more mallocs.  That's also
wasting resources, since quotearg avoids gratuitous
malloc/free traffic.




reply via email to

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