Re: value_copy in sfiglue.c (Re: Optimizations)



On Wed, 4 Feb 2004, Stefan Westerfeld wrote:

> On Tue, Feb 03, 2004 at 08:18:36PM +0100, Tim Janik wrote:
> > On Tue, 3 Feb 2004, Stefan Westerfeld wrote:
> > > * Patch #1: removes redundant value copy, by appending an empty value and
> > > filling it directly.
> > >
> > > Index: sfiglue.c
> > > ===================================================================
> > > RCS file: /cvs/gnome/beast/sfi/sfiglue.c,v
> > > retrieving revision 1.9
> > > diff -u -p -r1.9 sfiglue.c
> > > --- sfiglue.c	23 Dec 2003 04:50:55 -0000	1.9
> > > +++ sfiglue.c	2 Feb 2004 20:57:02 -0000
> > > @@ -339,14 +339,8 @@ sfi_glue_call_valist (const gchar *proc_
> > >  	error = g_strdup_printf ("%s: invalid category_type (%u)", G_STRLOC, arg_type);
> > >        else
> > >  	{
> > > -	  GValue value = { 0, };
> > > -	  g_value_init (&value, collect_type);
> > > -	  G_VALUE_COLLECT (&value, var_args, 0, &error);
> > > -	  if (!error)
> > > -	    {
> > > -	      sfi_seq_append (seq, &value);
> > > -	      g_value_unset (&value);
> > > -	    }
> > > +	  GValue *value = sfi_seq_append_empty (seq, collect_type);
> > > +	  G_VALUE_COLLECT (value, var_args, 0, &error);
> > >  	}
> > >        if (error)
> > >  	{
> >
> > this change alters behaviour, in case of error, the original
> > version doesn't append to the sequence while your version
> > does (unconditionally).
>
> But in case of error, the sequence gets freed anyway: the whole source of
> the patched version is:

ok, please apply.

>
>    Cu... Stefan

---
ciaoTJ




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