Commit 861600fa authored by Karl Wette's avatar Karl Wette
Browse files

SWIG: add ACQUIRES_OWNERSHIP() macro for disowning function arguments

Original: eab0a634302426b6edd0b8562efd870dbc19de01
parent 5855d2af
......@@ -1107,6 +1107,16 @@ if (swiglal_release_parent(PTR)) {
%set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, ($owner | %newpointer_flags) | SWIG_POINTER_OWN));
}
// The SWIGLAL(ACQUIRES_OWNERSHIP(...)) macro indicates that a function will acquire ownership
// of a particular argument, e.g. by storing that argument in some container, and that therefore
// the SWIG object wrapping that argument should no longer own its memory.
%define %swiglal_public_ACQUIRES_OWNERSHIP(TYPE, ...)
%swiglal_map_ab(%swiglal_apply, SWIGTYPE* DISOWN, TYPE, __VA_ARGS__);
%enddef
%define %swiglal_public_clear_ACQUIRES_OWNERSHIP(TYPE, ...)
%swiglal_map_a(%swiglal_clear, TYPE, __VA_ARGS__);
%enddef
// Typemaps for pointers to primitive scalars. These are treated as output-only
// arguments by default, by globally applying the SWIG OUTPUT typemaps. The INOUT
// typemaps can be supplied as needed using the SWIGLAL(INOUT_SCALARS(TYPE, ...)) macro.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment