Commit graph

19 commits

Author SHA1 Message Date
William S Fulton
364fa82499 Replicate Python memory leak fix in std::pair for Octave and Ruby
https://github.com/swig/swig/pull/851
2016-12-18 20:00:40 +00:00
William S Fulton
91aba9f719 UTL STL container descriptor checks
The vector of pointers (just fixed) were not working correctly because the
descriptors returned from swig::type_info() were sometimes returning
zero. Zero should only be used for void * as the subsequent call to
SWIG_ConvertPtr will blindly cast the pointer without checking
descriptor.

std::vector<void *> does not work and will require further changes:
specializing traits_info<void *> to return 0 and traits_asptr<void *>.
I tried this and traits_asptr<void> also needs to be added in which
seems odd and requires further investigation...

Lib/python/pystdcommon.swg:
  template <> struct traits_info<void *> {
    static swig_type_info *type_info() {
      static swig_type_info *info = 0;
    }
  };

Lib/std/std_common.i:
  template <>
  struct traits_asptr<void *> {
    static int asptr(PyObject *obj, void ***val) {
      void **p;
      swig_type_info *descriptor = 0;
      int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  };

  // this is needed, but am not sure this is expected
  template <>
  struct traits_asptr<void> {
    static int asptr(PyObject *obj, void **val) {
      void **p;
      swig_type_info *descriptor = 0;
      int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  };
2016-07-28 22:51:29 +01:00
William S Fulton
830de4d2f1 Various ruby-1.9.x compile fixes including patch from Nibble
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11862 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-13 16:59:41 +00:00
William S Fulton
12b89ff406 Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11859 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-13 15:06:26 +00:00
William S Fulton
c6b4403b40 remove dead code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10053 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-10-26 10:22:40 +00:00
Gonzalo Garramuno
765e3d27f0 Removed incorrect noconst trait.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9814 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-16 22:25:31 +00:00
Gonzalo Garramuno
d4eec2670b Fixed renames of std_* containers to a safer
%rename directive.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9810 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-16 21:27:08 +00:00
Gonzalo Garramuno
1b349d4749 Fixed a bug with argout values being incorrectly
returned when the first argout/returned element
was an array.

Made std::pair and container returned elements be
frozen (like tuples in python).

Added the std_containers.i test from python and
created a ruby runme file for it.




git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9746 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 22:40:55 +00:00
Gonzalo Garramuno
3ccbac69aa Fixed a problem with const correctness in new
adde std_pair.i functions.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9745 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 21:38:33 +00:00
Gonzalo Garramuno
a100f16bbd Fixes to std_map and multimap. There's still a problem
of const correctness in the std swig STL library.  
Need to bring it up in the swig-devel list.

Added new functions to swig_assert.
Changed some tests to reflect these changes.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9730 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 01:08:17 +00:00
Gonzalo Garramuno
a0b74a907e Updated Ruby's STL to new framework.
Still need to add new tests for multimap,
multiset, list, etc.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9719 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-04-30 06:36:55 +00:00
Olly Betts
2f6a268e55 Support building with recent versions of the Ruby 1.9 development branch.
Fixes bug #1560092.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9333 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-09-23 21:39:09 +00:00
Luigi Ballabio
2ba3707828 Fixes for std::pair typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9230 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-08-01 07:51:45 +00:00
William S Fulton
49be05f4fd Common template for head of each file detailing licence, distribution and authors information
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8973 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-07 00:14:10 +00:00
William S Fulton
cfdad24993 Use the system angle brackets for %include
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7871 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-26 09:28:20 +00:00
William S Fulton
4c4e3f47ad added missing constructors for std::pair
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7221 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-05-25 21:34:39 +00:00
Logan Johnson
5c3f981c51 Fix for the std_pair.i library file for Ruby.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5125 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-19 22:03:57 +00:00
Logan Johnson
b5b115f451 Correct macro name in Lib/ruby/std_pair.i; was "specialize_std_map_on_both",
should be "specialize_std_pair_on_both".


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4963 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-07-28 14:20:24 +00:00
Luigi Ballabio
dcb94e7d4a std::pair added (but not very much tested)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4959 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-07-10 12:42:42 +00:00