mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
f35b09c108
commit
8aee7f7e6a
1 changed files with 7 additions and 7 deletions
14
method.h
14
method.h
|
@ -60,27 +60,27 @@ typedef struct rb_method_entry_struct {
|
||||||
static inline void
|
static inline void
|
||||||
METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
|
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);
|
me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << IMEMO_FL_USHIFT+0);
|
||||||
}
|
}
|
||||||
static inline void
|
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);
|
VM_ASSERT(basic <= 1);
|
||||||
me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << IMEMO_FL_USHIFT+2);
|
me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << IMEMO_FL_USHIFT+2);
|
||||||
}
|
}
|
||||||
static inline void
|
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);
|
me->flags = (me->flags & ~(IMEMO_FL_USER3 | IMEMO_FL_USER4)) | (safe << IMEMO_FL_USHIFT+3);
|
||||||
}
|
}
|
||||||
static inline void
|
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(basic <= 1);
|
||||||
VM_ASSERT(safe <= 3);
|
VM_ASSERT(safe <= 1);
|
||||||
me->flags =
|
me->flags =
|
||||||
(me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2|IMEMO_FL_USER3|IMEMO_FL_USER4)) |
|
(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));
|
((visi << IMEMO_FL_USHIFT+0) | (basic << (IMEMO_FL_USHIFT+2)) | (safe << IMEMO_FL_USHIFT+3));
|
||||||
|
|
Loading…
Reference in a new issue