summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-26 08:30:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-26 08:30:22 +0000
commite615e3ce302e92c868b2f7b5a71fa628186497ec (patch)
tree75dd6237c053370c0ba872982d1a9a52753194c7 /error.c
parent61234dab9c43eb409ae85a4652ed50b9595b9cf5 (diff)
* 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
Diffstat (limited to 'error.c')
-rw-r--r--error.c9
1 files changed, 5 insertions, 4 deletions
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;