* eval_method.ci (rb_attr): should not use alloca for unknowen size
input. [ruby-dev:31816] * parse.y (rb_intern_str): prevent str from optimization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4fb45dd5dc
commit
0a274820bd
@ -1,3 +1,10 @@
|
|||||||
|
Sun Sep 23 08:58:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval_method.ci (rb_attr): should not use alloca for unknowen size
|
||||||
|
input. [ruby-dev:31816]
|
||||||
|
|
||||||
|
* parse.y (rb_intern_str): prevent str from optimization.
|
||||||
|
|
||||||
Sun Sep 23 06:16:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Sep 23 06:16:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval_method.ci (remove_method): check for undefined method.
|
* eval_method.ci (remove_method): check for undefined method.
|
||||||
|
@ -409,10 +409,8 @@ void
|
|||||||
rb_attr(VALUE klass, ID id, int read, int write, int ex)
|
rb_attr(VALUE klass, ID id, int read, int write, int ex)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
char *buf;
|
|
||||||
ID attriv;
|
ID attriv;
|
||||||
int noex;
|
int noex;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (!ex) {
|
if (!ex) {
|
||||||
noex = NOEX_PUBLIC;
|
noex = NOEX_PUBLIC;
|
||||||
@ -439,10 +437,7 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
|
|||||||
if (!name) {
|
if (!name) {
|
||||||
rb_raise(rb_eArgError, "argument needs to be symbol or string");
|
rb_raise(rb_eArgError, "argument needs to be symbol or string");
|
||||||
}
|
}
|
||||||
len = strlen(name) + 2;
|
attriv = rb_intern_str(rb_sprintf("@%s", name));
|
||||||
buf = ALLOCA_N(char, len);
|
|
||||||
snprintf(buf, len, "@%s", name);
|
|
||||||
attriv = rb_intern(buf);
|
|
||||||
if (read) {
|
if (read) {
|
||||||
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
|
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
|
||||||
}
|
}
|
||||||
|
4
parse.y
4
parse.y
@ -8528,7 +8528,9 @@ rb_intern(const char *name)
|
|||||||
ID
|
ID
|
||||||
rb_intern_str(VALUE str)
|
rb_intern_str(VALUE str)
|
||||||
{
|
{
|
||||||
return rb_intern3(RSTRING_PTR(str), RSTRING_LEN(str), rb_enc_get(str));
|
ID id = rb_intern3(RSTRING_PTR(str), RSTRING_LEN(str), rb_enc_get(str));
|
||||||
|
RB_GC_GUARD(str);
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user