summaryrefslogtreecommitdiff
path: root/method.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-01 08:18:03 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-01 08:18:03 (GMT)
commit8aee7f7e6a9bc6b9e183c9da69416b1892724460 (patch)
tree3bc6db9b0c8c950f508577d2a8c620b22bc97dc5 /method.h
parentf35b09c108d22c5717896dee7fed694c434a94b2 (diff)
method.h: update argument checks
* method.h (METHOD_ENTRY_VISI_SET, METHOD_ENTRY_BASIC_SET), (METHOD_ENTRY_SAFE_SET, METHOD_ENTRY_FLAGS_SET): get rid of negative arguments, and safe leve is restricted to 1 now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'method.h')
-rw-r--r--method.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/method.h b/method.h
index 87c4ba3..f66a384 100644
--- a/method.h
+++ b/method.h
@@ -60,27 +60,27 @@ typedef struct rb_method_entry_struct {
static inline void
METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
{
- VM_ASSERT(visi <= 3);
+ VM_ASSERT(visi >= 0 && visi <= 3);
me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << IMEMO_FL_USHIFT+0);
}
static inline void
-METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, int basic)
+METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, unsigned int basic)
{
VM_ASSERT(basic <= 1);
me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << IMEMO_FL_USHIFT+2);
}
static inline void
-METHOD_ENTRY_SAFE_SET(rb_method_entry_t *me, int safe)
+METHOD_ENTRY_SAFE_SET(rb_method_entry_t *me, unsigned int safe)
{
- VM_ASSERT(safe <= 3);
+ VM_ASSERT(safe <= 1);
me->flags = (me->flags & ~(IMEMO_FL_USER3 | IMEMO_FL_USER4)) | (safe << IMEMO_FL_USHIFT+3);
}
static inline void
-METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, int basic, int safe)
+METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic, unsigned int safe)
{
- VM_ASSERT(visi <= 3);
+ VM_ASSERT(visi >= 0 && visi <= 3);
VM_ASSERT(basic <= 1);
- VM_ASSERT(safe <= 3);
+ VM_ASSERT(safe <= 1);
me->flags =
(me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2|IMEMO_FL_USER3|IMEMO_FL_USER4)) |
((visi << IMEMO_FL_USHIFT+0) | (basic << (IMEMO_FL_USHIFT+2)) | (safe << IMEMO_FL_USHIFT+3));