mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Prefer ALLOCV over ALLOCA
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
70751a240f
commit
7ac1ff5fb7
1 changed files with 3 additions and 1 deletions
|
@ -610,10 +610,12 @@ global_id(const char *name)
|
||||||
if (name[0] == '$') id = rb_intern(name);
|
if (name[0] == '$') id = rb_intern(name);
|
||||||
else {
|
else {
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
char *buf = ALLOCA_N(char, len+1);
|
VALUE vbuf = 0;
|
||||||
|
char *buf = ALLOCV_N(char, vbuf, len+1);
|
||||||
buf[0] = '$';
|
buf[0] = '$';
|
||||||
memcpy(buf+1, name, len);
|
memcpy(buf+1, name, len);
|
||||||
id = rb_intern2(buf, len+1);
|
id = rb_intern2(buf, len+1);
|
||||||
|
ALLOCV_END(vbuf);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue