diff options
author | Michael Schroeder <mls@suse.de> | 2014-04-04 14:09:10 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2014-04-04 14:09:10 +0200 |
commit | fdff34f4855b84438b5bff3f79cba33d6bf35865 (patch) | |
tree | 52d95c28d67c6ae1216dc532eec8474c3f9d9e66 /bindings | |
parent | b8d3888fdcb2c625f9c025db9ca858ec8199d562 (diff) | |
download | libsolv-fdff34f4855b84438b5bff3f79cba33d6bf35865.tar.gz libsolv-fdff34f4855b84438b5bff3f79cba33d6bf35865.tar.bz2 libsolv-fdff34f4855b84438b5bff3f79cba33d6bf35865.zip |
more swig trickery: automaticall free the pool, add a disown method
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/solv.i | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/bindings/solv.i b/bindings/solv.i index eab2430..41cb49a 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -421,7 +421,18 @@ SWIG_AsValDepId(void *obj, int *val) { } - +%typemap(out) disown_helper { +#ifdef SWIGRUBY + SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 ); +#endif +#ifdef SWIGPYTHON + SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 ); +#endif +#ifdef SWIGPERL + SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 ); +#endif + $result = SWIG_From_int((int)(0)); +} %include "typemaps.i" @@ -599,6 +610,8 @@ typedef struct { typedef Dataiterator Datamatch; +typedef int disown_helper; + %} #ifdef SWIGRUBY @@ -1102,8 +1115,6 @@ typedef struct { Pool *pool = pool_create(); return pool; } - ~Pool() { - } void set_debuglevel(int level) { pool_setdebuglevel($self, level); } @@ -1203,10 +1214,18 @@ typedef struct { } #endif - void free() { + ~Pool() { Pool_set_loadcallback($self, 0); pool_free($self); } + disown_helper free() { + Pool_set_loadcallback($self, 0); + pool_free($self); + return 0; + } + disown_helper disown() { + return 0; + } Id str2id(const char *str, bool create=1) { return pool_str2id($self, str, create); } |