Re: minor fix for glib-genmarshal



Johannes Stezenbach <js convergence de> writes:

> Ron Steinke wrote:
> > 
> > This is an old patch I have to make glib-genmarshal use G_[BEGIN,END]_DECLS
> > instead of #ifdef __cplusplus. It's listed as bug 52797. Okay to commit?
> 
> While you're at it, would you mind taking care of bug 52116 also?
> 
> (A now grotesquely old one-liner [not counting braces and indentation]
> which deals with not calling g_object_unref on NULL pointers:

While this works, it strikes me as ugly -- to do a boolean test on an
object of unknown type. (You could imagine v_return being a structure
passed by value, though that won't happen currently.)

When I looked at this quickly, It seemed to me that the best way to do it 
would be to make sig->rarg->release a format, so you would do:
 
 fprintf (fout, sig->rarg->release, v_return);

Or somthing along those lines. But it would be good if Tim would look
at this, since it is his code.

Regards,
                                        Owen

> Index: glib-genmarshal.c
> ===================================================================
> RCS file: /cvs/gnome/glib/gobject/glib-genmarshal.c,v
> retrieving revision 1.7
> diff -u -r1.7 glib-genmarshal.c
> --- glib-genmarshal.c   2001/03/09 14:02:30     1.7
> +++ glib-genmarshal.c   2001/03/14 14:11:49
> @@ -398,7 +398,10 @@
>           fprintf (fout, "\n");
>           fprintf (fout, "  %s (return_value, v_return);\n", sig->rarg->setter);
>           if (sig->rarg->release)
> -           fprintf (fout, "  %s (v_return);\n", sig->rarg->release);
> +           {
> +             fprintf (fout, "  if (v_return)\n");
> +             fprintf (fout, "    %s (v_return);\n", sig->rarg->release);
> +           }
>         }
>  
>        /* cfile marshal footer */
> )




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