Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rb_iseqw_to_iseq to get iseq pointer #1093

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ext/debug/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ static VALUE rb_mDebugger;

// iseq
typedef struct rb_iseq_struct rb_iseq_t;
const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
VALUE rb_iseq_realpath(const rb_iseq_t *iseq);

static VALUE
iseq_realpath(VALUE iseqw)
{
rb_iseq_t *iseq = DATA_PTR(iseqw);
return rb_iseq_realpath(iseq);
return rb_iseq_realpath(rb_iseqw_to_iseq(iseqw));
}

static VALUE rb_cFrameInfo;
Expand Down Expand Up @@ -121,26 +121,26 @@ frame_depth(VALUE self)

// iseq

const struct rb_iseq *rb_iseqw_to_iseq(VALUE iseqw);
const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);

#ifdef HAVE_RB_ISEQ_TYPE
VALUE rb_iseq_type(const struct rb_iseq *);
VALUE rb_iseq_type(const rb_iseq_t *);

static VALUE
iseq_type(VALUE iseqw)
{
const struct rb_iseq *iseq = rb_iseqw_to_iseq(iseqw);
const rb_iseq_t *iseq = rb_iseqw_to_iseq(iseqw);
return rb_iseq_type(iseq);
}
#endif

#ifdef HAVE_RB_ISEQ_PARAMETERS
VALUE rb_iseq_parameters(const struct rb_iseq *, int is_proc);
VALUE rb_iseq_parameters(const rb_iseq_t *, int is_proc);

static VALUE
iseq_parameters_symbols(VALUE iseqw)
{
const struct rb_iseq *iseq = rb_iseqw_to_iseq(iseqw);
const rb_iseq_t *iseq = rb_iseqw_to_iseq(iseqw);
VALUE params = rb_iseq_parameters(iseq, 0);
VALUE ary = rb_ary_new();

Expand All @@ -167,12 +167,12 @@ iseq_parameters_symbols(VALUE iseqw)
#endif

#ifdef HAVE_RB_ISEQ_CODE_LOCATION
void rb_iseq_code_location(const struct rb_iseq *, int *first_lineno, int *first_column, int *last_lineno, int *last_column);
void rb_iseq_code_location(const rb_iseq_t *, int *first_lineno, int *first_column, int *last_lineno, int *last_column);

static VALUE
iseq_first_line(VALUE iseqw)
{
const struct rb_iseq *iseq = rb_iseqw_to_iseq(iseqw);
const rb_iseq_t *iseq = rb_iseqw_to_iseq(iseqw);
int line;
rb_iseq_code_location(iseq, &line, NULL, NULL, NULL);
return INT2NUM(line);
Expand All @@ -181,7 +181,7 @@ iseq_first_line(VALUE iseqw)
static VALUE
iseq_last_line(VALUE iseqw)
{
const struct rb_iseq *iseq = rb_iseqw_to_iseq(iseqw);
const rb_iseq_t *iseq = rb_iseqw_to_iseq(iseqw);
int line;
rb_iseq_code_location(iseq, NULL, NULL, &line, NULL);
return INT2NUM(line);
Expand Down
Loading