diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-22 23:58:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-22 23:58:03 +0000 |
commit | 1085a6cd700e00bf5431e32cfda913c68e81029e (patch) | |
tree | d556f932754ba4e7ab8378e638ea5fb358efa4a2 /eval_method.ci | |
parent | 400541ccf5d1560f509222fe48a5d8f64a19d62e (diff) | |
download | ruby-1085a6cd700e00bf5431e32cfda913c68e81029e.tar.gz ruby-1085a6cd700e00bf5431e32cfda913c68e81029e.tar.xz ruby-1085a6cd700e00bf5431e32cfda913c68e81029e.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_method.ci')
-rw-r--r-- | eval_method.ci | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/eval_method.ci b/eval_method.ci index 762e05aff..a647335ed 100644 --- a/eval_method.ci +++ b/eval_method.ci @@ -409,10 +409,8 @@ void rb_attr(VALUE klass, ID id, int read, int write, int ex) { const char *name; - char *buf; ID attriv; int noex; - size_t len; if (!ex) { noex = NOEX_PUBLIC; @@ -439,10 +437,7 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex) if (!name) { rb_raise(rb_eArgError, "argument needs to be symbol or string"); } - len = strlen(name) + 2; - buf = ALLOCA_N(char, len); - snprintf(buf, len, "@%s", name); - attriv = rb_intern(buf); + attriv = rb_intern_str(rb_sprintf("@%s", name)); if (read) { rb_add_method(klass, id, NEW_IVAR(attriv), noex); } |