summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-08-29 11:47:20 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-08-29 18:34:09 +0900
commit3df37259d81d9fc71f8b4f0b8d45dc9d0af81ab4 (patch)
tree961d975a0191b8385417c8107149a9610aa1f6dc /random.c
parentbfe5d22f89a871b6c1cb556c0115145ade9fe286 (diff)
drop-in type check for rb_define_singleton_method
We can check the function pointer passed to rb_define_singleton_method like how we do so in rb_define_method. Doing so revealed many arity mismatches.
Diffstat (limited to 'random.c')
-rw-r--r--random.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/random.c b/random.c
index 9d903f1..07ad236 100644
--- a/random.c
+++ b/random.c
@@ -93,14 +93,14 @@ typedef struct {
static rb_random_t default_rand;
static VALUE rand_init(struct MT *mt, VALUE vseed);
-static VALUE random_seed(void);
+static VALUE random_seed(VALUE);
static rb_random_t *
rand_start(rb_random_t *r)
{
struct MT *mt = &r->mt;
if (!genrand_initialized(mt)) {
- r->seed = rand_init(mt, random_seed());
+ r->seed = rand_init(mt, random_seed(Qundef));
}
return r;
}
@@ -261,7 +261,7 @@ random_init(int argc, VALUE *argv, VALUE obj)
if (rb_check_arity(argc, 0, 1) == 0) {
rb_check_frozen(obj);
- vseed = random_seed();
+ vseed = random_seed(obj);
}
else {
vseed = argv[0];
@@ -498,7 +498,7 @@ make_seed_value(uint32_t *ptr, size_t len)
* Random.new_seed #=> 115032730400174366788466674494640623225
*/
static VALUE
-random_seed(void)
+random_seed(VALUE _)
{
VALUE v;
uint32_t buf[DEFAULT_SEED_CNT+1];
@@ -691,7 +691,7 @@ rb_f_srand(int argc, VALUE *argv, VALUE obj)
rb_random_t *r = &default_rand;
if (rb_check_arity(argc, 0, 1) == 0) {
- seed = random_seed();
+ seed = random_seed(obj);
}
else {
seed = rb_to_int(argv[0]);