1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

intern.h: inline function rb_check_arity

* include/ruby/intern.h (rb_check_arity): make a static inline
  function so it can be used as an expression and argc would be
  evaulated only once.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-03-05 11:23:55 +00:00
parent 85164e551a
commit 708df44e59
2 changed files with 12 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Tue Mar 5 20:23:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/intern.h (rb_check_arity): make a static inline
function so it can be used as an expression and argc would be
evaulated only once.
Tue Mar 5 12:30:55 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems.rb: Bump version to 2.0.1 for upcoming bugfix release

View file

@ -266,10 +266,12 @@ const char *rb_sourcefile(void);
VALUE rb_check_funcall(VALUE, ID, int, VALUE*);
NORETURN(void rb_error_arity(int, int, int));
#define rb_check_arity(argc, min, max) do { \
if (((argc) < (min)) || ((argc) > (max) && (max) != UNLIMITED_ARGUMENTS)) \
rb_error_arity(argc, min, max); \
} while(0)
static inline void
rb_check_arity(int argc, int min, int max)
{
if ((argc < min) || (max != UNLIMITED_ARGUMENTS && argc > max))
rb_error_arity(argc, min, max);
}
#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
typedef struct {