Perl - Add support for missing directorfree typemaps
Related to issue #1167, to free up memory when returning reference types. SWIG_Perl_AcquirePtr still needs implementing.
This commit is contained in:
parent
e86c881a70
commit
717b7866d4
3 changed files with 21 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.0.0 (in progress)
|
||||
===========================
|
||||
|
||||
2017-12-13: wsfulton
|
||||
[Perl] add missing support for directorfree typemaps.
|
||||
|
||||
2017-12-13: wsfulton
|
||||
Issue #1167 Fix directorout typemaps which were causing undefined behaviour when
|
||||
returning pointers by reference.
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
|
||||
#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
|
||||
#define SWIG_NewPointerObj(p, type, flags) SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
|
||||
#define SWIG_AcquirePtr(ptr, src) SWIG_Perl_AcquirePtr(ptr, src)
|
||||
#define swig_owntype int
|
||||
|
||||
/* for raw packed data */
|
||||
|
|
@ -229,6 +230,14 @@ SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Acquire a pointer value */
|
||||
|
||||
SWIGRUNTIME int
|
||||
SWIG_Perl_AcquirePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, int own) {
|
||||
/* TODO */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Function for getting a pointer value */
|
||||
|
||||
SWIGRUNTIME int
|
||||
|
|
|
|||
|
|
@ -900,6 +900,15 @@ public:
|
|||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
||||
if (director_method) {
|
||||
if ((tm = Swig_typemap_lookup("directorfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", "ST(argvi)");
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
}
|
||||
|
||||
Printv(f->code, "XSRETURN(argvi);\n", "fail:\n", cleanup, "SWIG_croak_null();\n" "}\n" "}\n", NIL);
|
||||
|
||||
/* Add the dXSARGS last */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue