mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
tkutil.c: reduce unnecessary buffer
* ext/tk/tkutil/tkutil.c (cbsubst_get_subst_key): reduce unnecessary buffer. the result string is one byte per one word. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
33604da3f6
commit
912ae57b8a
1 changed files with 2 additions and 2 deletions
|
@ -1458,7 +1458,7 @@ cbsubst_get_subst_key(self, str)
|
||||||
volatile VALUE ret;
|
volatile VALUE ret;
|
||||||
long i, len, keylen;
|
long i, len, keylen;
|
||||||
int idx;
|
int idx;
|
||||||
char *buf, *ptr, *key;
|
char *buf, *ptr;
|
||||||
|
|
||||||
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
|
list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str);
|
||||||
Check_Type(list, T_ARRAY);
|
Check_Type(list, T_ARRAY);
|
||||||
|
@ -1466,7 +1466,7 @@ cbsubst_get_subst_key(self, str)
|
||||||
|
|
||||||
inf = cbsubst_get_ptr(self);
|
inf = cbsubst_get_ptr(self);
|
||||||
|
|
||||||
ptr = buf = ALLOC_N(char, inf->full_subst_length + len + 1);
|
ptr = buf = ALLOC_N(char, len + 1);
|
||||||
|
|
||||||
for(i = 0; i < len; i++) {
|
for(i = 0; i < len; i++) {
|
||||||
VALUE keyval = RARRAY_CONST_PTR(list)[i];
|
VALUE keyval = RARRAY_CONST_PTR(list)[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue