Permalink
Browse files

* ext/hpricot_scan: big problems on Ruby 1.8.6, use INT2FIX instead …

…of INT2NUM. hashes were being cast to bignums.
  • Loading branch information...
1 parent cd161c1 commit ceda421d7e9061c54bc84cc44451f21aee644b8a _why committed Apr 3, 2009
Showing with 2,118 additions and 2,122 deletions.
  1. +2,112 −2,116 ext/hpricot_scan/hpricot_css.c
  2. +3 −3 ext/hpricot_scan/hpricot_scan.c
  3. +3 −3 ext/hpricot_scan/hpricot_scan.rl
View
4,228 ext/hpricot_scan/hpricot_css.c
2,112 additions, 2,116 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
6 ext/hpricot_scan/hpricot_scan.c
@@ -247,7 +247,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
if (H_ELE_GET(S->focus, H_ELE_EC) == sym_CDATA &&
(sym != sym_procins && sym != sym_comment && sym != sym_cdata && sym != sym_text) &&
- !(sym == sym_etag && INT2NUM(rb_str_hash(tag)) == H_ELE_GET(S->focus, H_ELE_HASH)))
+ !(sym == sym_etag && INT2FIX(rb_str_hash(tag)) == H_ELE_GET(S->focus, H_ELE_HASH)))
{
sym = sym_text;
tag = rb_str_new(raw, rawlen);
@@ -265,7 +265,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
}
if (sym == sym_emptytag || sym == sym_stag) {
- VALUE name = INT2NUM(rb_str_hash(tag));
+ VALUE name = INT2FIX(rb_str_hash(tag));
H_ELE(cElem);
H_ELE_SET(ele, H_ELE_HASH, name);
@@ -325,7 +325,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
//
// (see also: the search above for fixups)
//
- name = INT2NUM(rb_str_hash(tag));
+ name = INT2FIX(rb_str_hash(tag));
while (e != S->doc)
{
if (H_ELE_GET(e, H_ELE_HASH) == name)
View
6 ext/hpricot_scan/hpricot_scan.rl
@@ -280,7 +280,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
if (H_ELE_GET(S->focus, H_ELE_EC) == sym_CDATA &&
(sym != sym_procins && sym != sym_comment && sym != sym_cdata && sym != sym_text) &&
- !(sym == sym_etag && INT2NUM(rb_str_hash(tag)) == H_ELE_GET(S->focus, H_ELE_HASH)))
+ !(sym == sym_etag && INT2FIX(rb_str_hash(tag)) == H_ELE_GET(S->focus, H_ELE_HASH)))
{
sym = sym_text;
tag = rb_str_new(raw, rawlen);
@@ -298,7 +298,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
}
if (sym == sym_emptytag || sym == sym_stag) {
- VALUE name = INT2NUM(rb_str_hash(tag));
+ VALUE name = INT2FIX(rb_str_hash(tag));
H_ELE(cElem);
H_ELE_SET(ele, H_ELE_HASH, name);
@@ -358,7 +358,7 @@ rb_hpricot_token(hpricot_state *S, VALUE sym, VALUE tag, VALUE attr, char *raw,
//
// (see also: the search above for fixups)
//
- name = INT2NUM(rb_str_hash(tag));
+ name = INT2FIX(rb_str_hash(tag));
while (e != S->doc)
{
if (H_ELE_GET(e, H_ELE_HASH) == name)

0 comments on commit ceda421

Please sign in to comment.