Subject: | Please provide mg_findext and sv_unmagicext |
Date: | Fri, 10 Dec 2010 20:44:46 +0100 |
To: | bug-Devel-PPPort [...] rt.cpan.org |
From: | Florian Ragwitz <rafl [...] debian.org> |
Commits 39de7f53b474076d5a8e28b5b41fddefd29e45d7 and
b83794c7d64c56b8d918c51e93d1136d33fa202b to bleadperl added the
following new API functions:
ApdR |MAGIC* |mg_findext |NULLOK const SV* sv|int type|NULLOK const MGVTBL *vtbl
Apd |int |sv_unmagicext |NN SV *const sv|const int type|NULLOK MGVTBL *vtbl
Those functions provide an interface similar to mg_find and sv_unmagic
that takes magic virtual tables into account, similar to how there
exists an sv_magicext in addition to sv_magic.
They are intended to be used by extensions and are mostly useful when
attaching PERL_MAGIC_ext to scalars, for example to attach pointers on
the C level, without breaking other extensions that might want to attach
their own magic to the same scalar.
Implementing them on perls that don't have them isn't very hard and the
two aforementioned commits show how to do that - by walking the scalar's
SvMAGIC list, comparing to the requested MGVTBL and, in case of
sv_unmagicext, re-linking that list.
If these functions were provided by ppport.h, many modules could get rid
of their runtime dependency on XS::Object::Magic as well as their
build-dependency on ExtUtils::Depends.
Thanks for considering to provide those functions in ppport.h.
Message body not shown because it is not plain text.