diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-31 15:08:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-05-31 15:08:05 +0000 |
commit | 912ae57b8a71b62951940e89cdb76f6ad5a71205 (patch) | |
tree | 274ab8b465ea7ee2a0a4e0e3478b9e901d939855 | |
parent | 33604da3f68213b7bdb52c3e8af5767fbc5af79b (diff) | |
download | ruby-912ae57b8a71b62951940e89cdb76f6ad5a71205.tar.gz |
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
-rw-r--r-- | ext/tk/tkutil/tkutil.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c index e0b8581759..34ee8d8e78 100644 --- a/ext/tk/tkutil/tkutil.c +++ b/ext/tk/tkutil/tkutil.c @@ -1458,7 +1458,7 @@ cbsubst_get_subst_key(self, str) volatile VALUE ret; long i, len, keylen; int idx; - char *buf, *ptr, *key; + char *buf, *ptr; list = rb_funcall(cTclTkLib, ID_split_tklist, 1, str); Check_Type(list, T_ARRAY); @@ -1466,7 +1466,7 @@ cbsubst_get_subst_key(self, str) 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++) { VALUE keyval = RARRAY_CONST_PTR(list)[i]; |