From 8aee7f7e6a9bc6b9e183c9da69416b1892724460 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 1 Jul 2015 08:18:03 +0000 Subject: [PATCH] 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 --- method.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/method.h b/method.h index 87c4ba314e..f66a384d7d 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));