from ");
write_escaping_html(out,
- RSTRING(ep->ptr[i])->ptr,
- RSTRING(ep->ptr[i])->len);
+ RSTRING_PTR(RARRAY_PTR(ep)[i]),
+ RSTRING_LEN(RARRAY_PTR(ep)[i]));
}
else {
fprintf(out, " from ");
- fwrite(RSTRING(ep->ptr[i])->ptr, 1,
- RSTRING(ep->ptr[i])->len, out);
+ fwrite(RSTRING_PTR(RARRAY_PTR(ep)[i]), 1,
+ RSTRING_LEN(RARRAY_PTR(ep)[i]), out);
}
if (cgi)
fprintf(out, "
\n");
else
fprintf(out, "\n");
}
- if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
+ if (i == TRACE_HEAD && RARRAY_LEN(ep) > TRACE_MAX) {
char buff[BUFSIZ];
if (cgi)
snprintf(buff, BUFSIZ,
"... %ld levels...\n",
- ep->len - TRACE_HEAD - TRACE_TAIL);
+ RARRAY_LEN(ep) - TRACE_HEAD - TRACE_TAIL);
else
snprintf(buff, BUFSIZ, " ... %ld levels...
\n",
- ep->len - TRACE_HEAD - TRACE_TAIL);
+ RARRAY_LEN(ep) - TRACE_HEAD - TRACE_TAIL);
if (cgi)
write_escaping_html(out, buff, strlen(buff));
else
fputs(buff, out);
- i = ep->len - TRACE_TAIL;
+ i = RARRAY_LEN(ep) - TRACE_TAIL;
}
}
}
@@ -251,10 +272,10 @@
}
if (cgi) {
- write_escaping_html(out, RSTRING(code)->ptr, RSTRING(code)->len);
+ write_escaping_html(out, RSTRING_PTR(code), RSTRING_LEN(code));
}
else {
- fwrite(RSTRING(code)->ptr, 1, RSTRING(code)->len, out);
+ fwrite(RSTRING_PTR(code), 1, RSTRING_LEN(code), out);
}
if (cgi) {
fprintf(out, "\n");
@@ -394,15 +415,14 @@
static VALUE defout_write(VALUE self, VALUE str)
{
str = rb_obj_as_string(str);
- rb_str_cat(self, RSTRING(str)->ptr, RSTRING(str)->len);
+ rb_str_cat(self, RSTRING_PTR(str), RSTRING_LEN(str));
return Qnil;
}
static VALUE defout_cancel(VALUE self)
{
- if (RSTRING(self)->len == 0) return Qnil;
- RSTRING(self)->len = 0;
- RSTRING(self)->ptr[0] = '\0';
+ if (RSTRING_LEN(self) == 0) return Qnil;
+ self = rb_str_new("", 0);
return Qnil;
}
@@ -556,7 +576,7 @@
Init_stack(&stack_start);
code = eruby_load(eruby_filename, 0, &state);
- if (state && !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
+ if (state && !rb_obj_is_kind_of(rb_errinfo(), rb_eSystemExit)) {
if (RTEST(ruby_debug) &&
(eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI)) {
error_print(stdout, state, 1, eruby_mode, code);
@@ -571,8 +591,8 @@
print_generated_code(stderr, code, 0);
}
#if RUBY_VERSION_CODE >= 180
- out = RSTRING(rb_stdout)->ptr;
- nout = RSTRING(rb_stdout)->len;
+ out = RSTRING_PTR(rb_stdout);
+ nout = RSTRING_LEN(rb_stdout);
#else
out = RSTRING(rb_defout)->ptr;
nout = RSTRING(rb_defout)->len;