On 10/11/2007, chromatic <[EMAIL PROTECTED]> wrote:
> On Friday 09 November 2007 09:00:00 [EMAIL PROTECTED] wrote:
>
> > Author: paultcochrane
> > Date: Fri Nov  9 08:59:59 2007
> > New Revision: 22780
> >
> > Modified:
> >    trunk/src/objects.c
> >    trunk/src/pmc/namespace.pmc
> >    trunk/src/pmc_freeze.c
> >
> > Log:
> > [core,pmc] Removed unreachable code compiler warnings
> >
> > Modified: trunk/src/objects.c
> > ===========================================================================
> >=== --- trunk/src/objects.c    (original)
> > +++ trunk/src/objects.c       Fri Nov  9 08:59:59 2007
> > @@ -1918,10 +1918,8 @@
> >
> >      /* RT#45989 escape NUL char */
> >      if (VTABLE_exists_keyed_str(interp, attr_hash, full_attr_name)) {
> > -        char * const c_error = string_to_cstring(interp, full_attr_name);
> > -        real_exception(interp, NULL, 1, "Attribute '%s' already exists",
> > c_error); -        /* RT#45991 leak! */
> > -        string_cstring_free(c_error);
> > +        real_exception(interp, NULL, 1, "Attribute '%s' already exists",
> > +                string_to_cstring(interp, full_attr_name));
> >      }
>
> I'm not a huge fan of this, especially when removing the RT #45591 link, but a
> better solution is to use the format %Ss, which tells Parrot's sprintf engine
> that it's getting a STRING.  This avoids the memory leak of
> string_to_cstring().

Ok, that's good to know.  I'll go through and change the recent
commits of this kind to use %Ss which probably also means that I can
get rid of the ticket as well, right?

Paul

Reply via email to