summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-21 09:43:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-21 09:43:10 +0000
commit073982a0fcfa76e444ce374437b05b1bcf5831d6 (patch)
tree0ac7bb94d725eacba6c2622292e971c259c1072c /gc.c
parente8c4115d8b2bd633fc98b624f2138e8adb66cc62 (diff)
fix screw-ups in gc.c and marshal.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gc.c b/gc.c
index e470ea9407..0c0bdc1485 100644
--- a/gc.c
+++ b/gc.c
@@ -42,7 +42,7 @@ void rb_io_fptr_finalize _((struct OpenFile*));
# if defined(HAVE_ALLOCA_H)
# include <alloca.h>
# elif !defined(alloca)
-char *alloca();
+void *alloca();
# endif
#endif /* __GNUC__ */
@@ -1296,11 +1296,13 @@ id2ref(obj, id)
rb_secure(4);
p0 = ptr = NUM2UINT(id);
- if (FIXNUM_P(ptr)) return (VALUE)ptr;
- if (SYMBOL_P(ptr)) return (VALUE)ptr;
if (ptr == Qtrue) return Qtrue;
if (ptr == Qfalse) return Qfalse;
if (ptr == Qnil) return Qnil;
+ if (FIXNUM_P(ptr)) return (VALUE)ptr;
+ if (SYMBOL_P(ptr) && rb_id2name(SYM2ID((VALUE)ptr)) != 0) {
+ return (VALUE)ptr;
+ }
ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
if (!is_pointer_to_heap(ptr)) {