From e615e3ce302e92c868b2f7b5a71fa628186497ec Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 26 Apr 2008 08:30:22 +0000 Subject: * error.c (builtin_types), signal.c (siglist), st.c (primes), struct.c (ref_func), time.c (months): constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 0901878533..00433fb08f 100644 --- a/error.c +++ b/error.c @@ -238,7 +238,7 @@ rb_compile_bug(const char *file, int line, const char *fmt, ...) abort(); } -static struct types { +static const struct types { int type; const char *name; } builtin_types[] = { @@ -263,20 +263,21 @@ static struct types { {T_MATCH, "MatchData"}, /* data of $~ */ {T_NODE, "Node"}, /* internal use: syntax tree node */ {T_UNDEF, "undef"}, /* internal use: #undef; should not happen */ - {-1, 0} }; void rb_check_type(VALUE x, int t) { - struct types *type = builtin_types; + const struct types *type = builtin_types; + const struct types *const typeend = builtin_types + + sizeof(builtin_types) / sizeof(builtin_types[0]); if (x == Qundef) { rb_bug("undef leaked to the Ruby space"); } if (TYPE(x) != t) { - while (type->type >= 0) { + while (type < typeend) { if (type->type == t) { const char *etype; -- cgit v1.2.3