1
0
Fork 0
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:
nobu 2018-11-25 03:36:10 +00:00
parent 70751a240f
commit 7ac1ff5fb7

View file

@ -610,10 +610,12 @@ global_id(const char *name)
if (name[0] == '$') id = rb_intern(name);
else {
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] = '$';
memcpy(buf+1, name, len);
id = rb_intern2(buf, len+1);
ALLOCV_END(vbuf);
}
return id;
}