Re: gperl_callback_invoke userdata copy



Kevin Ryde wrote:

Do we want to support assigning to $_[-1]?

It could be in the docs if it's meant to work.  I can't see any
disadvantage, it gets you a free bit of "state data" if you want to use
it that way.

I see GClosure for signals is this way -- refcnt inc and mortalize --
and assigning alters the stored data.  I guess GPerlCallback can be the
same.  The net change then to it is just a refcount fix which was
tickled by a callback disconnecting/destroying itself.

Yeah.  Makes sense.

The patch looks good to me, except for this bit:

+                       SvREFCNT_inc_simple_void_NN (data);
+                       XPUSHs (sv_2mortal (data));

Why not this instead?

                        XPUSHs (sv_2mortal (SvREFCNT_inc (data)));

Or, if you really wanted to avoid the duplicate NULL check, SvREFCNT_inc_NN
instead of SvREFCNT_inc.  But I don't think the win justifies using an obscure
SvREFCNT_inc variant.

-Torsten



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