Skip to content

Commit 497289a

Browse files
committed
Fix cast from pointer to integer of different size [-Wpointer-to-int-cast] warning
1 parent 0beaff1 commit 497289a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

optional/capi/ext/tracepoint_spec.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77
extern "C" {
88
#endif
99

10-
static long callback_called = 0;
10+
static VALUE callback_called = Qnil;
1111

1212
static void callback(VALUE tpval, void *data) {
13-
callback_called = (long)data;
13+
callback_called = (VALUE) data;
1414
}
1515

1616
static VALUE tracepoint_spec_rb_tracepoint_new(VALUE self, VALUE data) {
17-
long data_long = FIX2LONG(data);
18-
return rb_tracepoint_new(Qnil, RUBY_EVENT_LINE, callback, (void *)data_long);
17+
return rb_tracepoint_new(Qnil, RUBY_EVENT_LINE, callback, (void*) data);
1918
}
2019

2120
static VALUE tracepoint_spec_callback_called(VALUE self){
22-
return LONG2FIX(callback_called);
21+
return callback_called;
2322
}
2423

2524
static VALUE tracepoint_spec_rb_tracepoint_disable(VALUE self, VALUE trace) {

0 commit comments

Comments
 (0)