* ext/dl/cptr.c (rb_dlptr_cmp): return signed value, and restrict

to Fixnum.  [ruby-dev:38533]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-05-23 09:48:54 +00:00
Родитель 4bdd854347
Коммит fb3fa6aa4e
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sat May 23 18:48:52 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/dl/cptr.c (rb_dlptr_cmp): return signed value, and restric
to Fixnum. [ruby-dev:38533]
Fri May 22 23:22:53 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* missing/vsnprintf.c (errno): [BUG] fixes a compilation

Просмотреть файл

@ -318,9 +318,12 @@ VALUE
rb_dlptr_cmp(VALUE self, VALUE other)
{
void *ptr1, *ptr2;
SIGNED_VALUE diff;
ptr1 = rb_dlptr2cptr(self);
ptr2 = rb_dlptr2cptr(other);
return PTR2NUM((long)ptr1 - (long)ptr2);
diff = (SIGNED_VALUE)ptr1 - (SIGNED_VALUE)ptr2;
if (!diff) return INT2FIX(0);
return diff > 0 ? INT2NUM(1) : INT2NUM(-1);
}
VALUE