-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed problems preventing C extensions from building on some platforms.
- Loading branch information
Showing
4 changed files
with
30 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef rb_check_arity | ||
|
||
// https://github.com/ruby/ruby/blob/ruby_2_0_0/include/ruby/intern.h | ||
// rb_check_arity was added in Ruby 2.0 | ||
|
||
#define UNLIMITED_ARGUMENTS (-1) | ||
|
||
static inline void rb_error_arity(int argc, int min, int max) | ||
{ | ||
VALUE err_mess = 0; | ||
if (min == max) { | ||
err_mess = rb_sprintf("wrong number of arguments (%d for %d)", argc, min); | ||
} | ||
else if (max == UNLIMITED_ARGUMENTS) { | ||
err_mess = rb_sprintf("wrong number of arguments (%d for %d+)", argc, min); | ||
} | ||
else { | ||
err_mess = rb_sprintf("wrong number of arguments (%d for %d..%d)", argc, min, max); | ||
} | ||
rb_raise(rb_eTypeError, err_mess); | ||
} | ||
|
||
#define rb_check_arity(argc, min, max) do { \ | ||
if (((argc) < (min)) || ((argc) > (max) && (max) != UNLIMITED_ARGUMENTS)) \ | ||
rb_error_arity(argc, min, max); \ | ||
} while(0) | ||
|
||
#endif |