зеркало из https://github.com/github/ruby.git
* prevent temporary objects from GC, and should not use
RSTRING_PTR() for function calls since it evaluates the argument a couple of times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4ab39d2202
Коммит
e7c0a6e1d7
|
@ -1,3 +1,9 @@
|
|||
Sun Feb 20 16:23:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* prevent temporary objects from GC, and should not use
|
||||
RSTRING_PTR() for function calls since it evaluates the argument
|
||||
a couple of times.
|
||||
|
||||
Sun Feb 20 16:22:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (rb_file_flock): use rb_thread_io_blocking_region for the
|
||||
|
|
|
@ -5211,7 +5211,7 @@ get_exception_sym2type(VALUE sym)
|
|||
if (sym == symNext) return CATCH_TYPE_NEXT;
|
||||
sym_inspect = rb_inspect(sym);
|
||||
rb_raise(rb_eSyntaxError, "invalid exception symbol: %s",
|
||||
RSTRING_PTR(RB_GC_GUARD(sym_inspect)));
|
||||
StringValuePtr(sym_inspect));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
3
error.c
3
error.c
|
@ -356,7 +356,8 @@ rb_check_type(VALUE x, int t)
|
|||
etype = "Symbol";
|
||||
}
|
||||
else if (rb_special_const_p(x)) {
|
||||
etype = RSTRING_PTR(rb_obj_as_string(x));
|
||||
x = rb_obj_as_string(x);
|
||||
etype = StringValuePtr(x);
|
||||
}
|
||||
else {
|
||||
etype = rb_obj_classname(x);
|
||||
|
|
5
io.c
5
io.c
|
@ -7498,8 +7498,9 @@ advice_arg_check(VALUE advice)
|
|||
advice != sym_willneed &&
|
||||
advice != sym_dontneed &&
|
||||
advice != sym_noreuse) {
|
||||
rb_raise(rb_eNotImpError, "Unsupported advice: :%s",
|
||||
RSTRING_PTR(rb_id2str(SYM2ID(advice))));
|
||||
VALUE symname = rb_inspect(advice);
|
||||
rb_raise(rb_eNotImpError, "Unsupported advice: %s",
|
||||
StringValuePtr(symname));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,8 @@ rb_class_name(VALUE klass)
|
|||
const char *
|
||||
rb_class2name(VALUE klass)
|
||||
{
|
||||
return RSTRING_PTR(rb_class_name(klass));
|
||||
VALUE name = rb_class_name(klass);
|
||||
return RSTRING_PTR(name);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
2
vm.c
2
vm.c
|
@ -1446,7 +1446,7 @@ rb_thread_current_status(const rb_thread_t *th)
|
|||
}
|
||||
else if (cfp->me->def->original_id) {
|
||||
str = rb_sprintf("`%s#%s' (cfunc)",
|
||||
RSTRING_PTR(rb_class_name(cfp->me->klass)),
|
||||
rb_class2name(cfp->me->klass),
|
||||
rb_id2name(cfp->me->def->original_id));
|
||||
}
|
||||
|
||||
|
|
|
@ -1015,7 +1015,8 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
|
|||
th->base_block = 0;
|
||||
|
||||
if (0) { /* for debug */
|
||||
printf("%s\n", RSTRING_PTR(rb_iseq_disasm(iseqval)));
|
||||
VALUE disasm = rb_iseq_disasm(iseqval);
|
||||
printf("%s\n", StringValuePtr(disasm));
|
||||
}
|
||||
|
||||
/* save new env */
|
||||
|
|
|
@ -1143,7 +1143,7 @@ vm_check_if_namespace(VALUE klass)
|
|||
default:
|
||||
str = rb_inspect(klass);
|
||||
rb_raise(rb_eTypeError, "%s is not a class/module",
|
||||
RSTRING_PTR(RB_GC_GUARD(str)));
|
||||
StringValuePtr(str));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче