[前][次][番号順一覧][スレッド一覧]

ruby-changes:38615

From: nobu <ko1@a...>
Date: Mon, 1 Jun 2015 00:08:23 +0900 (JST)
Subject: [ruby-changes:38615] nobu:r50696 (trunk): tkutil.c: reduce unnecessary buffer

nobu	2015-06-01 00:08:05 +0900 (Mon, 01 Jun 2015)

  New Revision: 50696

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50696

  Log:
    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.

  Modified files:
    trunk/ext/tk/tkutil/tkutil.c
Index: ext/tk/tkutil/tkutil.c
===================================================================
--- ext/tk/tkutil/tkutil.c	(revision 50695)
+++ ext/tk/tkutil/tkutil.c	(revision 50696)
@@ -1458,7 +1458,7 @@ cbsubst_get_subst_key(self, str) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1458
     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) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1466
 
     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];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]