1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
parent 4bdd854347
commit fb3fa6aa4e
2 changed files with 9 additions and 1 deletions

View file

@ -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> Fri May 22 23:22:53 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* missing/vsnprintf.c (errno): [BUG] fixes a compilation * missing/vsnprintf.c (errno): [BUG] fixes a compilation

View file

@ -318,9 +318,12 @@ VALUE
rb_dlptr_cmp(VALUE self, VALUE other) rb_dlptr_cmp(VALUE self, VALUE other)
{ {
void *ptr1, *ptr2; void *ptr1, *ptr2;
SIGNED_VALUE diff;
ptr1 = rb_dlptr2cptr(self); ptr1 = rb_dlptr2cptr(self);
ptr2 = rb_dlptr2cptr(other); 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 VALUE