Skip to content

Commit

Permalink
Fix function prototype in tkutil.c
Browse files Browse the repository at this point in the history
Fix funciton prototype for
* tkstr_invalid_numstr (argument for rb_rescue2)
* tkstr_rescue_float (argument for rb_rescue2)
* tkstr_to_str (argument for rb_rescue2)
* subst_mark (for struct rb_data_type_t)
* subst_free (for struct rb_data_type_t)
* subst_memsize (for struct rb_data_type_t)
  • Loading branch information
mtasaka authored and jeremyevans committed Jan 17, 2025
1 parent 264a6f3 commit 3ae4c39
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions ext/tk/tkutil/tkutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,15 +1000,15 @@ tkstr_to_float(VALUE value)
}

static VALUE
tkstr_invalid_numstr(VALUE value)
tkstr_invalid_numstr(VALUE value, VALUE unused)
{
rb_raise(rb_eArgError,
"invalid value for Number: '%s'", RSTRING_PTR(value));
return Qnil; /*dummy*/
}

static VALUE
tkstr_rescue_float(VALUE value)
tkstr_rescue_float(VALUE value, VALUE unused)
{
return rb_rescue2(tkstr_to_float, value,
tkstr_invalid_numstr, value,
Expand All @@ -1034,7 +1034,7 @@ tcl2rb_number(VALUE self, VALUE value)
}

static VALUE
tkstr_to_str(VALUE value)
tkstr_to_str(VALUE value, VALUE unused)
{
char * ptr;
long len;
Expand All @@ -1055,7 +1055,7 @@ tcl2rb_string(VALUE self, VALUE value)

if (RSTRING_PTR(value) == (char*)NULL) return rb_str_new2("");

return tkstr_to_str(value);
return tkstr_to_str(value, Qnil);
}

static VALUE
Expand Down Expand Up @@ -1095,16 +1095,18 @@ struct cbsubst_info {
};

static void
subst_mark(struct cbsubst_info *ptr)
subst_mark(void *arg)
{
struct cbsubst_info *ptr = (struct cbsubst_info *)arg;
rb_gc_mark(ptr->proc);
rb_gc_mark(ptr->aliases);
}

static void
subst_free(struct cbsubst_info *ptr)
subst_free(void *arg)
{
int i;
struct cbsubst_info *ptr = (struct cbsubst_info *)arg;

if (ptr) {
for(i = 0; i < CBSUBST_TBL_MAX; i++) {
Expand All @@ -1118,8 +1120,9 @@ subst_free(struct cbsubst_info *ptr)
}

static size_t
subst_memsize(const struct cbsubst_info *ptr)
subst_memsize(const void *arg)
{
struct cbsubst_info *ptr = (struct cbsubst_info *)arg;
return sizeof(*ptr);
}

Expand Down

0 comments on commit 3ae4c39

Please sign in to comment.