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

* error.c (builtin_types), gc.c (count_objects): added Complex and

Rational.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-04-26 08:42:34 +00:00
parent 52ee839409
commit c7451eb725
3 changed files with 34 additions and 23 deletions

View file

@ -1,3 +1,8 @@
Sat Apr 26 17:42:30 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (builtin_types), gc.c (count_objects): added Complex and
Rational.
Sat Apr 26 17:35:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Apr 26 17:35:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (rb_eNOERROR): renamed. * error.c (rb_eNOERROR): renamed.

View file

@ -256,6 +256,8 @@ static const struct types {
{T_STRUCT, "Struct"}, {T_STRUCT, "Struct"},
{T_BIGNUM, "Bignum"}, {T_BIGNUM, "Bignum"},
{T_FILE, "File"}, {T_FILE, "File"},
{T_RATIONAL,"Rational"},
{T_COMPLEX, "Complex"},
{T_TRUE, "true"}, {T_TRUE, "true"},
{T_FALSE, "false"}, {T_FALSE, "false"},
{T_SYMBOL, "Symbol"}, /* :symbol */ {T_SYMBOL, "Symbol"}, /* :symbol */

50
gc.c
View file

@ -2231,29 +2231,33 @@ count_objects(int argc, VALUE *argv, VALUE os)
for (i = 0; i <= T_MASK; i++) { for (i = 0; i <= T_MASK; i++) {
VALUE type; VALUE type;
switch (i) { switch (i) {
case T_NONE: type = ID2SYM(rb_intern("T_NONE")); break; #define COUNT_TYPE(t) case t: type = ID2SYM(rb_intern(#t)); break;
case T_NIL: type = ID2SYM(rb_intern("T_NIL")); break; COUNT_TYPE(T_NONE);
case T_OBJECT: type = ID2SYM(rb_intern("T_OBJECT")); break; COUNT_TYPE(T_OBJECT);
case T_CLASS: type = ID2SYM(rb_intern("T_CLASS")); break; COUNT_TYPE(T_CLASS);
case T_ICLASS: type = ID2SYM(rb_intern("T_ICLASS")); break; COUNT_TYPE(T_MODULE);
case T_MODULE: type = ID2SYM(rb_intern("T_MODULE")); break; COUNT_TYPE(T_FLOAT);
case T_FLOAT: type = ID2SYM(rb_intern("T_FLOAT")); break; COUNT_TYPE(T_STRING);
case T_STRING: type = ID2SYM(rb_intern("T_STRING")); break; COUNT_TYPE(T_REGEXP);
case T_REGEXP: type = ID2SYM(rb_intern("T_REGEXP")); break; COUNT_TYPE(T_ARRAY);
case T_ARRAY: type = ID2SYM(rb_intern("T_ARRAY")); break; COUNT_TYPE(T_HASH);
case T_FIXNUM: type = ID2SYM(rb_intern("T_FIXNUM")); break; COUNT_TYPE(T_STRUCT);
case T_HASH: type = ID2SYM(rb_intern("T_HASH")); break; COUNT_TYPE(T_BIGNUM);
case T_STRUCT: type = ID2SYM(rb_intern("T_STRUCT")); break; COUNT_TYPE(T_FILE);
case T_BIGNUM: type = ID2SYM(rb_intern("T_BIGNUM")); break; COUNT_TYPE(T_DATA);
case T_FILE: type = ID2SYM(rb_intern("T_FILE")); break; COUNT_TYPE(T_MATCH);
case T_TRUE: type = ID2SYM(rb_intern("T_TRUE")); break; COUNT_TYPE(T_COMPLEX);
case T_FALSE: type = ID2SYM(rb_intern("T_FALSE")); break; COUNT_TYPE(T_RATIONAL);
case T_DATA: type = ID2SYM(rb_intern("T_DATA")); break; COUNT_TYPE(T_NIL);
case T_MATCH: type = ID2SYM(rb_intern("T_MATCH")); break; COUNT_TYPE(T_TRUE);
case T_SYMBOL: type = ID2SYM(rb_intern("T_SYMBOL")); break; COUNT_TYPE(T_FALSE);
case T_VALUES: type = ID2SYM(rb_intern("T_VALUES")); break; COUNT_TYPE(T_SYMBOL);
case T_UNDEF: type = ID2SYM(rb_intern("T_UNDEF")); break; COUNT_TYPE(T_FIXNUM);
case T_NODE: type = ID2SYM(rb_intern("T_NODE")); break; COUNT_TYPE(T_VALUES);
COUNT_TYPE(T_UNDEF);
COUNT_TYPE(T_NODE);
COUNT_TYPE(T_ICLASS);
#undef COUNT_TYPE
default: type = INT2NUM(i); break; default: type = INT2NUM(i); break;
} }
if (counts[i]) if (counts[i])