Fixed last test in std_set test suite that was

failing due to having been done with old hash sort.

Improved rubycontainer a little bit.  Made GC_VALUE
sort an rb_protect function to prevent bad sorting
attempt of an Array against a String.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Gonzalo Garramuno 2007-05-02 01:28:21 +00:00
commit cea5ba04fa
4 changed files with 58 additions and 26 deletions

View file

@ -135,6 +135,13 @@ namespace std {
static ID cmp_id;
static ID hash_id;
static VALUE swig_protect_funcall( VALUE p )
{
swig::GC_VALUE* args = (swig::GC_VALUE*) p;
return rb_funcall(VALUE(args[0]), cmp_id, 1, VALUE(args[1]));
}
bool
operator()( const swig::GC_VALUE& v, const swig::GC_VALUE& w ) const
{
@ -145,7 +152,10 @@ namespace std {
// First, try to compare using the <=> operator if present
if ( rb_respond_to( v, cmp_id ) == Qtrue )
{
ret = rb_funcall(VALUE(v), cmp_id, 1, VALUE(w));
int status;
swig::GC_VALUE args[] = { v, w };
ret = rb_protect( PROTECTFUNC(swig_protect_funcall), VALUE(args),
&status );
}
bool res;