# Ext/tk/tkutil

**URL:** <https://www.ruby-forum.com/t/ext-tk-tkutil/67496>\
**Category:** Development\
**Created:** [September 4, 2006, 4:39pm UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496 "2006-09-04T16:39:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 4, 2006, 4:39pm UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/1 "2006-09-04T16:39:33Z")

</div>

e$B$J$+$@$G$9!#e(B

1.9e$B$Ge(Bext/tk/tkutile$B$,%3%s%Q%$%k%(%i!\<$K$J$j$^$9!#$H$j$"$($:5!3#e(B  
e$BE\*$KJQ49$7$?%Q%C%A$G$9!#e(B

e$B$A$J$\_$K!“e(Brb\_str\_set\_len()e$B$O$”$k$h$&$G$9$,!"e(Brb\_ary\_set\_len()e$B$Oe(B  
e$BDI2C$5$l$J$$$s$G$7$g$&$+!#e(B

# Index: ext/tk/tkutil/tkutil.c

RCS file: /cvs/ruby/src/ruby/ext/tk/tkutil/tkutil.c,v  
retrieving revision 1.15  
diff -p -U 2 -r1.15 tkutil.c  
— ext/tk/tkutil/tkutil.c 31 Aug 2006 11:56:41 -0000 1.15  
+++ ext/tk/tkutil/tkutil.c 4 Sep 2006 14:27:49 -0000  
@@ -268,9 +268,9 @@ ary2list(ary, enc\_flag, self)  
}

- /\* size = RARRAY(ary)-\>len; \*/

- /\* size = RARRAY\_LEN(ary); \*/  
size = 0;

- for(idx = 0; idx \< RARRAY(ary)-\>len; idx++) {
- 

```
   if (TYPE(RARRAY(ary)->ptr[idx]) == T_HASH) {

```

- 

```
       size += 2 * RHASH(RARRAY(ary)->ptr[idx])->tbl->num_entries;

```

- for(idx = 0; idx \< RARRAY\_LEN(ary); idx++) {
- 

```
   if (TYPE(RARRAY_PTR(ary)[idx]) == T_HASH) {

```

- 

```
       size += 2 * RHASH(RARRAY_PTR(ary)[idx])->tbl->num_entries;
   } else {
       size++;

```

@@ -279,12 +279,11 @@ ary2list(ary, enc\_flag, self)

```
 dst = rb_ary_new2(size);

```

- RARRAY(dst)-\>len = 0;
- for(idx = 0; idx \< RARRAY(ary)-\>len; idx++) {
- 

```
   val = RARRAY(ary)->ptr[idx];

```

- for(idx = 0; idx \< RARRAY\_LEN(ary); idx++) {
- 

```
   val = RARRAY_PTR(ary)[idx];
   str_val = Qnil;
   switch(TYPE(val)) {
   case T_ARRAY:
       str_val = ary2list(val, enc_flag, self);

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;

```

- 

```
       rb_ary_push(dst, str_val);

       if (req_chk_flag) {

```

@@ -304,5 +303,5 @@ ary2list(ary, enc\_flag, self)

```
     case T_HASH:

```

- 

```
       /* RARRAY(dst)->ptr[RARRAY(dst)->len++] = hash2list(val, 

```

self); \*/

- 

```
  /* rb_ary_push(dst, hash2list(val, self)); */
       if (RTEST(enc_flag)) {
           val = hash2kv_enc(val, Qnil, self);

```

@@ -310,11 +309,11 @@ ary2list(ary, enc\_flag, self)  
val = hash2kv(val, Qnil, self);  
}

- 

```
       size2 = RARRAY(val)->len;

```

- 

```
       size2 = RARRAY_LEN(val);
       for(idx2 = 0; idx2 < size2; idx2++) {

```

- 

```
           val2 = RARRAY(val)->ptr[idx2];

```

- 

```
           val2 = RARRAY_PTR(val)[idx2];
           switch(TYPE(val2)) {
           case T_ARRAY:
               str_val = ary2list(val2, enc_flag, self);

```

- 

```
               RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;

```

- 

```
               rb_ary_push(dst, str_val);
               break;

```

@@ -325,5 +324,5 @@ ary2list(ary, enc\_flag, self)  
str\_val = hash2list(val2, self);  
}

- 

```
               RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;

```

- 

```
               rb_ary_push(dst, str_val);
               break;

```

@@ -331,5 +330,5 @@ ary2list(ary, enc\_flag, self)  
if (val2 != TK\_None) {  
str\_val = get\_eval\_string\_core(val2, enc\_flag,  
self);

- 

```
                   RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;

```

- 

```
                   rb_ary_push(dst, str_val);
               }
           }

```

@@ -353,5 +352,5 @@ ary2list(ary, enc\_flag, self)  
if (val != TK\_None) {  
str\_val = get\_eval\_string\_core(val, enc\_flag, self);

- 

```
           RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;

```

- 

```
           rb_ary_push(dst, str_val);

           if (req_chk_flag) {

```

@@ -372,6 +371,6 @@ ary2list(ary, enc\_flag, self)

```
 if (RTEST(dst_enc) && !NIL_P(sys_enc)) {

```

- 

```
   for(idx = 0; idx < RARRAY(dst)->len; idx++) {

```

- 

```
       str_val = RARRAY(dst)->ptr[idx];

```

- 

```
   for(idx = 0; idx < RARRAY_LEN(dst); idx++) {

```

- 

```
       str_val = RARRAY_PTR(dst)[idx];
       if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
           str_val = rb_funcall(self, ID_toUTF8, 1, str_val);

```

@@ -379,5 +378,5 @@ ary2list(ary, enc\_flag, self)  
str\_val = rb\_funcall(cTclTkLib, ID\_toUTF8, 1, str\_val);  
}

- 

```
       RARRAY(dst)->ptr[idx] = str_val;

```

- 

```
       RARRAY_PTR(dst)[idx] = str_val;
   }
   val = rb_apply(cTclTkLib, ID_merge_tklist, dst);

```

@@ -422,9 +421,8 @@ ary2list2(ary, enc\_flag, self)  
}

- size = RARRAY(ary)-\>len;

- size = RARRAY\_LEN(ary);  
dst = rb\_ary\_new2(size);

- RARRAY(dst)-\>len = 0;
- for(idx = 0; idx \< RARRAY(ary)-\>len; idx++) {
- 

```
   val = RARRAY(ary)->ptr[idx];

```

- for(idx = 0; idx \< RARRAY\_LEN(ary); idx++) {
- 

```
   val = RARRAY_PTR(ary)[idx];
   str_val = Qnil;
   switch(TYPE(val)) {

```

@@ -448,5 +446,5 @@ ary2list2(ary, enc\_flag, self)

```
     if (!NIL_P(str_val)) {

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = str_val;

```

- 

```
       rb_ary_push(dst, str_val);

       if (req_chk_flag) {

```

@@ -466,6 +464,6 @@ ary2list2(ary, enc\_flag, self)

```
 if (RTEST(dst_enc) && !NIL_P(sys_enc)) {

```

- 

```
   for(idx = 0; idx < RARRAY(dst)->len; idx++) {

```

- 

```
       str_val = RARRAY(dst)->ptr[idx];

```

- 

```
   for(idx = 0; idx < RARRAY_LEN(dst); idx++) {

```

- 

```
       str_val = RARRAY_PTR(dst)[idx];
       if (rb_obj_respond_to(self, ID_toUTF8, Qtrue)) {
           str_val = rb_funcall(self, ID_toUTF8, 1, str_val);

```

@@ -473,5 +471,5 @@ ary2list2(ary, enc\_flag, self)  
str\_val = rb\_funcall(cTclTkLib, ID\_toUTF8, 1, str\_val);  
}

- 

```
       RARRAY(dst)->ptr[idx] = str_val;

```

- 

```
       RARRAY_PTR(dst)[idx] = str_val;
   }
   val = rb_apply(cTclTkLib, ID_merge_tklist, dst);

```

@@ -504,21 +502,20 @@ assoc2kv(assoc, ary, self)  
volatile VALUE pair;  
volatile VALUE val;

- volatile VALUE dst = rb\_ary\_new2(2 \* RARRAY(assoc)-\>len);

- volatile VALUE dst = rb\_ary\_new2(2 \* RARRAY\_LEN(assoc));

- len = RARRAY(assoc)-\>len;

- len = RARRAY\_LEN(assoc);

- 

```
   pair = RARRAY(assoc)->ptr[i];

```

- 

```
   pair = RARRAY_PTR(assoc)[i];
   if (TYPE(pair) != T_ARRAY) {

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = key2keyname(pair);

```

- 

```
       rb_ary_push(dst, key2keyname(pair));
       continue;
   }

```

- 

```
   switch(RARRAY(assoc)->len) {

```

- 

```
   switch(RARRAY_LEN(assoc)) {
   case 2:

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = 

```

RARRAY(pair)-\>ptr[2];

- 

```
       rb_ary_push(dst, RARRAY_PTR(pair)[2]);

   case 1:

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = key2keyname(RARRAY(pair)->ptr[0]);

```

- 

```
       rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));

   case 0:

```

@@ -526,14 +523,12 @@ assoc2kv(assoc, ary, self)

```
     default:

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = key2keyname(RARRAY(pair)->ptr[0]);

```

- 

```
       rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));

```

- 

```
       val = rb_ary_new2(RARRAY(pair)->len - 1);

```

- 

```
       RARRAY(val)->len = 0;

```

- 

```
       for(j = 1; j < RARRAY(pair)->len; j++) {

```

- 

```
           RARRAY(val)->ptr[RARRAY(val)->len++] = 

```

RARRAY(pair)-\>ptr[j];

- 

```
       val = rb_ary_new2(RARRAY_LEN(pair) - 1);

```

- 

```
       for(j = 1; j < RARRAY_LEN(pair); j++) {

```

- 

```
           rb_ary_push(val, RARRAY_PTR(pair)[j]);
       }

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = val;

```

- 

```
       rb_ary_push(dst, val);
   }

```

}  
@@ -555,22 +550,20 @@ assoc2kv\_enc(assoc, ary, self)  
volatile VALUE pair;  
volatile VALUE val;

- volatile VALUE dst = rb\_ary\_new2(2 \* RARRAY(assoc)-\>len);

- volatile VALUE dst = rb\_ary\_new2(2 \* RARRAY\_LEN(assoc));

- len = RARRAY(assoc)-\>len;

- len = RARRAY\_LEN(assoc);

- 

```
   pair = RARRAY(assoc)->ptr[i];

```

- 

```
   pair = RARRAY_PTR(assoc)[i];
   if (TYPE(pair) != T_ARRAY) {

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = key2keyname(pair);

```

- 

```
       rb_ary_push(dst, key2keyname(pair));
       continue;
   }

```

- 

```
   switch(RARRAY(assoc)->len) {

```

- 

```
   switch(RARRAY_LEN(assoc)) {
   case 2:

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = get_eval_string_core(RARRAY(pair)->ptr[2], Qtrue, 

```

self);

- 

```
       rb_ary_push(dst, get_eval_string_core(RARRAY_PTR(pair)[2], 

```

Qtrue, self));

```
     case 1:

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = key2keyname(RARRAY(pair)->ptr[0]);

```

- 

```
       rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));

   case 0:

```

@@ -578,15 +571,12 @@ assoc2kv\_enc(assoc, ary, self)

```
     default:

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = key2keyname(RARRAY(pair)->ptr[0]);

```

- 

```
       rb_ary_push(dst, key2keyname(RARRAY_PTR(pair)[0]));

```

- 

```
       val = rb_ary_new2(RARRAY(pair)->len - 1);

```

- 

```
       RARRAY(val)->len = 0;

```

- 

```
       for(j = 1; j < RARRAY(pair)->len; j++) {

```

- 

```
           RARRAY(val)->ptr[RARRAY(val)->len++] = 

```

RARRAY(pair)-\>ptr[j];

- 

```
       val = rb_ary_new2(RARRAY_LEN(pair) - 1);

```

- 

```
       for(j = 1; j < RARRAY_LEN(pair); j++) {

```

- 

```
           rb_ary_push(val, RARRAY_PTR(pair)[j]);
       }

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = get_eval_string_core(val, Qtrue, self);

```

- 

```
       rb_ary_push(dst, get_eval_string_core(val, Qtrue, self));
   }

```

}  
@@ -607,5 +597,5 @@ push\_kv(key, val, args)  
volatile VALUE ary;

- ary = RARRAY(args)-\>ptr[0];

- ary = RARRAY\_PTR(args)[0];

- RARRAY(ary)-\>ptr[RARRAY(ary)-\>len++] = key2keyname(key);

- rb\_ary\_push(ary, key2keyname(key));

- RARRAY(ary)-\>ptr[RARRAY(ary)-\>len++]
- 

```
   = get_eval_string_core(val, Qnil, RARRAY(args)->ptr[1]);

```

- rb\_ary\_push(ary, get\_eval\_string\_core(val, Qnil,  
RARRAY\_PTR(args)[1]));

- volatile VALUE args = rb\_ary\_new2(2);  
volatile VALUE dst = rb\_ary\_new2(2 \*  
RHASH(hash)-\>tbl-\>num\_entries);

- volatile VALUE args = rb\_ary\_new3(2, dst, self);

- RARRAY(dst)-\>len = 0;
- 
- RARRAY(args)-\>ptr[0] = dst;
- RARRAY(args)-\>ptr[1] = self;
- RARRAY(args)-\>len = 2;  
st\_foreach(RHASH(hash)-\>tbl, push\_kv, args);

@@ -655,5 +639,5 @@ push\_kv\_enc(key, val, args)  
volatile VALUE ary;

- ary = RARRAY(args)-\>ptr[0];

- ary = RARRAY\_PTR(args)[0];

- 

```
                                         RARRAY(args)->ptr[1]));

```

- 

```
                                         RARRAY_PTR(args)[1]));

```

}  
#endif

- RARRAY(ary)-\>ptr[RARRAY(ary)-\>len++] = key2keyname(key);

- rb\_ary\_push(ary, key2keyname(key));

- RARRAY(ary)-\>ptr[RARRAY(ary)-\>len++]
- 

```
   = get_eval_string_core(val, Qtrue, RARRAY(args)->ptr[1]);

```

- rb\_ary\_push(ary, get\_eval\_string\_core(val, Qtrue,  
RARRAY\_PTR(args)[1]));

- volatile VALUE args = rb\_ary\_new2(2);  
volatile VALUE dst = rb\_ary\_new2(2 \*  
RHASH(hash)-\>tbl-\>num\_entries);

- volatile VALUE args = rb\_ary\_new3(2, dst, self);

- RARRAY(dst)-\>len = 0;
- 
- RARRAY(args)-\>ptr[0] = dst;
- RARRAY(args)-\>ptr[1] = self;
- RARRAY(args)-\>len = 2;  
st\_foreach(RHASH(hash)-\>tbl, push\_kv\_enc, args);

@@ -923,5 +901,4 @@ tk\_conv\_args(argc, argv, self)  
/\* dst = rb\_ary\_new2(argc - 2); \*/  
dst = rb\_ary\_new2(size);

- RARRAY(dst)-\>len = 0;  
for(idx = 2; idx \< argc; idx++) {  
if (TYPE(argv[idx]) == T\_HASH) {  
@@ -932,6 +909,5 @@ tk\_conv\_args(argc, argv, self)  
}  
} else if (argv[idx] != TK\_None) {
- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = get_eval_string_core(argv[idx], argv[1], self);

```

- 

```
       rb_ary_push(dst, get_eval_string_core(argv[idx], argv[1], 

```

self));  
}  
}  
@@ -1302,9 +1278,9 @@ cbsubst\_get\_subst\_key(self, str)  
list = rb\_funcall(cTclTkLib, ID\_split\_tklist, 1, str);

- len = RARRAY(list)-\>len;

- len = RARRAY\_LEN(list);  
buf = ALLOC\_N(char, len + 1);

- 

```
   ptr = RSTRING_PTR(RARRAY(list)->ptr[i]);

```

- 

```
   ptr = RSTRING_PTR(RARRAY_PTR(list)[i]);
   if (*ptr == '%' && *(ptr + 2) == '\0') {
       *(buf + i) = *(ptr + 1);

```

@@ -1357,5 +1333,5 @@ cbsubst\_table\_setup(self, key\_inf, proc\_  
struct cbsubst\_info \*subst\_inf;  
int idx;

- int len = RARRAY(key\_inf)-\>len;

- int len = RARRAY\_LEN(key\_inf);  
int real\_len = 0;  
char \*key = ALLOC\_N(char, len + 1);  
@@ -1382,8 +1358,8 @@ cbsubst\_table\_setup(self, key\_inf, proc\_  
\*/  
for(idx = 0; idx \< len; idx++) {

- 

```
   inf = RARRAY(key_inf)->ptr[idx];

```

- 

```
   inf = RARRAY_PTR(key_inf)[idx];
   if (TYPE(inf) != T_ARRAY) continue;

```

- 

```
   *(key + real_len) = (char)NUM2INT(RARRAY(inf)->ptr[0]);

```

- 

```
   *(type + real_len) = (char)NUM2INT(RARRAY(inf)->ptr[1]);

```

- 

```
   *(key + real_len) = (char)NUM2INT(RARRAY_PTR(inf)[0]);

```

- 

```
   *(type + real_len) = (char)NUM2INT(RARRAY_PTR(inf)[1]);

   *(ivar + real_len)

```

@@ -1391,9 +1367,9 @@ cbsubst\_table\_setup(self, key\_inf, proc\_  
RSTRING\_PTR(  
rb\_str\_cat2(rb\_str\_new2("@"),

- 

```
                         rb_id2name(SYM2ID(RARRAY(inf)->ptr[2])))

```

- 

```
                         rb_id2name(SYM2ID(RARRAY_PTR(inf)[2])))
           )
         );

```

- 

```
   rb_attr(self, SYM2ID(RARRAY(inf)->ptr[2]), 1, 0, Qtrue);

```

- 

```
   rb_attr(self, SYM2ID(RARRAY_PTR(inf)[2]), 1, 0, Qtrue);
   real_len++;

```

}  
@@ -1407,9 +1383,9 @@ cbsubst\_table\_setup(self, key\_inf, proc\_  
\* proc ==\> proc/method/obj (must respond to ‘call’)  
\*/

- len = RARRAY(proc\_inf)-\>len;

- len = RARRAY\_LEN(proc\_inf);  
for(idx = 0; idx \< len; idx++) {

- 

```
   inf = RARRAY(proc_inf)->ptr[idx];

```

- 

```
   inf = RARRAY_PTR(proc_inf)[idx];
   if (TYPE(inf) != T_ARRAY) continue;

```

- 

```
   rb_hash_aset(proc, RARRAY(inf)->ptr[0], RARRAY(inf)->ptr[1]);

```

- 

```
   rb_hash_aset(proc, RARRAY_PTR(inf)[0], RARRAY_PTR(inf)[1]);

```

}

@@ -1436,5 +1412,5 @@ cbsubst\_scan\_args(self, arg\_key, val\_ary  
struct cbsubst\_info \*inf;  
int idx;

- int len = RARRAY(val\_ary)-\>len;

- int len = RARRAY\_LEN(val\_ary);  
char c;  
char \*ptr;  
@@ -1452,5 +1428,4 @@ cbsubst\_scan\_args(self, arg\_key, val\_ary  
struct cbsubst\_info, inf);

- RARRAY(dst)-\>len = 0;  
for(idx = 0; idx \< len; idx++) {  
if (idx \>= RSTRING\_LEN(arg\_key)) {  
@@ -1469,8 +1444,7 @@ cbsubst\_scan\_args(self, arg\_key, val\_ary

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++] = 

```

RARRAY(val\_ary)-\>ptr[idx];

- 

```
       rb_ary_push(dst, RARRAY_PTR(val_ary)[idx]);
   } else {

```

- 

```
       RARRAY(dst)->ptr[RARRAY(dst)->len++]

```

- 

```
           = rb_funcall(proc, ID_call, 1, 

```

RARRAY(val\_ary)-\>ptr[idx]);

- 

```
       rb_ary_push(dst, rb_funcall(proc, ID_call, 1, 

```

RARRAY\_PTR(val\_ary)[idx]));  
}  
}

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 4, 2006, 4:57pm UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/2 "2006-09-04T16:57:40Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:29473] ext/tk/tkutil”  
on Mon, 4 Sep 2006 23:34:41 +0900, removed\_email\_address@domain.invalid writes:

|1.9e$B$Ge(Bext/tk/tkutile$B$,%3%s%Q%$%k%(%i!\<$K$J$j$^$9!#$H$j$"$($:5!3#e(B  
|e$BE\*$KJQ49$7$?%Q%C%A$G$9!#e(B

e$B%3%\_%C%H$7$F$/$@$5$$!#e(B

|e$B$A$J$\_$K!“e(Brb\_str\_set\_len()e$B$O$”$k$h$&$G$9$,!"e(Brb\_ary\_set\_len()e$B$Oe(B  
|e$BDI2C$5$l$J$$$s$G$7$g$&$+!#e(B

e$BKh2s%\*%s%G%^%s%I$J$b$N$G$9$+$i!#$I$3$+$GI,MW@-$,=P$?$i4n$s$Ge(B  
e$BDI2C$7$^$9!#e(B

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 4, 2006, 9:56pm UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/3 "2006-09-04T21:56:18Z")

</div>

e$B$J$+$@$G$9!#e(B

At Mon, 4 Sep 2006 23:56:28 +0900,  
Yukihiro M. wrote in [ruby-dev:29474]:

> |e$B$A$J$\_$K!“e(Brb\_str\_set\_len()e$B$O$”$k$h$&$G$9$,!"e(Brb\_ary\_set\_len()e$B$Oe(B  
> |e$BDI2C$5$l$J$$$s$G$7$g$&$+!#e(B
> 
> e$BKh2s%\*%s%G%^%s%I$J$b$N$G$9$+$i!#$I$3$+$GI,MW@-$,=P$?$i4n$s$Ge(B  
> e$BDI2C$7$^$9!#e(B

rb\_ary\_new2()e$B$7$?D\>8e$Oe(BRARRAY\_LEN()e$B$O\>o$Ke(B0e$B$J$N$G!"H\>J,$OC1=c$Ke(B  
e$B\>C$7$^$7$?!#;D$j$Oe(B  
RARRAY\_PTR(dst)[RARRAY\_LEN(dst)++] = val  
e$B$H$$$&7A$J$N$Ge(Brb\_ary\_push()e$B$GBeMQ$7$^$7$?$,!"8zN(LL$+$i$$$&$He(B  
rb\_ary\_set\_len()e$B$r;H$$$?$$$N$+$b$7$l$^$;$s!#$3$l$O1J0f$5$s$NH=e(B  
e$BCG$rBT$C$?$[$&$,$$$$$N$+$b!#e(B

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 5, 2006, 7:45am UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/4 "2006-09-05T07:45:15Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:29485] Re: ext/tk/tkutil”  
on Tue, 5 Sep 2006 13:52:08 +0900, Hidetoshi NAGAI  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|e$B$^$@e(B patch e$B$N%A%'%C%/$O$7$F$$$J$$$N$G$9$,!$e(B  
|tkutil e$B$NCf?H$GG[Ns$r$$$8$C$F$$$kItJ,$Oe(B  
|e$B%a%=%C%I8F$S=P$7;~$N0z?tNs$NJQ49$J$I$NItJ,$@$H;W$$$^$9!%e(B  
|e$B$=$&$7$?ItJ,$O!$e(BRuby → Tk e$B$N8F$S=P$7$NEY$KMxMQ$5$l$k$?$a!$e(B  
|e$BMxMQIQEY$,9b$/!$8zN($K6A$$$F$/$kItJ,$G$9e(B ( e$B$H;W$$$^$9e(B (^\_^; )e$B!%e(B  
|rb\_ary\_push() e$B$J$I$N\<jCJ$rMQ$$$:$KD\>@$$$8$C$F$$$?$N$O$=$N$?$a$G$9!%e(B  
|rb\_ary\_push() e$B$G$NBeMQ$7$+J}K!$,$J$$$H$$$&$N$J$i;EJ}$J$$$N$G$9$,!$e(B  
|low cost e$B$J\<jCJ$,MQ0U$G$-$k$N$G$"$l$P!$$\<$R$\*4j$$$7$?$$$G$9!%e(B

e$B$H$j$"$($:CY$/$F:$$C$F$+$i8!F$$7$^$;$s$+!)e(B  
premature optimisation is source of all evil.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 5, 2006, 6:53am UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/5 "2006-09-05T06:53:09Z")

</div>

e$B1J0fe(B@e$BCNG=!%6e9)Bg$G$9!%e(B

e$B5$$E$/$N$,CY$/$F$9$\_$^$;$s!%e(B

From: removed\_email\_address@domain.invalid  
Subject: [ruby-dev:29479] Re: ext/tk/tkutil  
Date: Tue, 5 Sep 2006 04:54:45 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> rb\_ary\_new2()e$B$7$?D\>8e$Oe(BRARRAY\_LEN()e$B$O\>o$Ke(B0e$B$J$N$G!"H\>J,$OC1=c$Ke(B  
> e$B\>C$7$^$7$?!#;D$j$Oe(B  
> RARRAY\_PTR(dst)[RARRAY\_LEN(dst)++] = val  
> e$B$H$$$&7A$J$N$Ge(Brb\_ary\_push()e$B$GBeMQ$7$^$7$?$,!"8zN(LL$+$i$$$&$He(B  
> rb\_ary\_set\_len()e$B$r;H$$$?$$$N$+$b$7$l$^$;$s!#$3$l$O1J0f$5$s$NH=e(B  
> e$BCG$rBT$C$?$[$&$,$$$$$N$+$b!#e(B

e$B$^$@e(B patch e$B$N%A%'%C%/$O$7$F$$$J$$$N$G$9$,!$e(B  
tkutil e$B$NCf?H$GG[Ns$r$$$8$C$F$$$kItJ,$Oe(B  
e$B%a%=%C%I8F$S=P$7;~$N0z?tNs$NJQ49$J$I$NItJ,$@$H;W$$$^$9!%e(B  
e$B$=$&$7$?ItJ,$O!$e(BRuby → Tk e$B$N8F$S=P$7$NEY$KMxMQ$5$l$k$?$a!$e(B  
e$BMxMQIQEY$,9b$/!$8zN($K6A$$$F$/$kItJ,$G$9e(B ( e$B$H;W$$$^$9e(B (^\_^;  
)e$B!%e(B  
rb\_ary\_push()  
e$B$J$I$N\<jCJ$rMQ$$$:$KD\>@$$$8$C$F$$$?$N$O$=$N$?$a$G$9!%e(B  
rb\_ary\_push() e$B$G$NBeMQ$7$+J}K!$,$J$$$H$$$&$N$J$i;EJ}$J$$$N$G$9$,!$e(B  
low cost e$B$J\<jCJ$,MQ0U$G$-$k$N$G$"$l$P!$$\<$R$\*4j$$$7$?$$$G$9!%e(B

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 5, 2006, 8:15am UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/6 "2006-09-05T08:15:18Z")

</div>

e$B1J0fe(B@e$BCNG=!%6e9)Bg$G$9!%e(B

From: Yukihiro M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [ruby-dev:29486] Re: ext/tk/tkutil  
Date: Tue, 5 Sep 2006 14:41:36 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> e$B$H$j$"$($:CY$/$F:$$C$F$+$i8!F$$7$^$;$s$+!)e(B  
> premature optimisation is source of all evil.

e$B0JA0$K!VCY$/$F:$$C$?!W$N$G0z?tNsJQ49$re(B C e$BHG$K$7$?$s$G$9$,!$e(B  
e$B$=$N;~!$e(Brb\_ary\_push() e$B$J$I$r;H$C$?$N$G$O8z2L$,Gv$+$C$?$N$Ge(B  
e$B$"$N$h$&$K$7$?$H$$$&5$$,$7$F$^$9!%!%!%$,!$5$$N$;$$$+$b$7$l$^$;$s!%e(B  
e$BA0$N%a!\<%k$Ge(B

> |e$BMxMQIQEY$,9b$/!$8zN($K6A$$$F$/$kItJ,$G$9e(B ( e$B$H;W$$$^$9e(B (^\_^; )e$B!%e(B

e$B$H=q$$$F$?$N$O!$$=$NJU$j$N5-21$,$O$C$-$j$7$J$$$?$a$G$9!%e(B

e$B$^$!!$%3%s%Q%$%k$G$-$J$$$N$G$OOC$K$J$i$J$$$N$G!$e(B  
e$B$H$j$"$($:$O;H$($k5!G=$G\<BAu$7$F$\*$/$7$+$J$$$N$G$7$g$&$M$'!%!%!%e(B

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 5, 2006, 8:27am UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/7 "2006-09-05T08:27:21Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:29487] Re: ext/tk/tkutil”  
on Tue, 5 Sep 2006 15:15:01 +0900, Hidetoshi NAGAI  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|e$B0JA0$K!VCY$/$F:$$C$?!W$N$G0z?tNsJQ49$re(B C e$BHG$K$7$?$s$G$9$,!$e(B  
|e$B$=$N;~!$e(Brb\_ary\_push() e$B$J$I$r;H$C$?$N$G$O8z2L$,Gv$+$C$?$N$Ge(B  
|e$B$“$N$h$&$K$7$?$H$$$&5$$,$7$F$^$9!%!%!%$,!$5$$N$;$$$+$b$7$l$^$;$s!%e(B  
|e$BA0$N%a!\<%k$Ge(B  
|  
|\> |e$BMxMQIQEY$,9b$/!$8zN($K6A$$$F$/$kItJ,$G$9e(B ( e$B$H;W$$$^$9e(B (^\_^; )e$B!%e(B  
|  
|e$B$H=q$$$F$?$N$O!$$=$NJU$j$N5-21$,$O$C$-$j$7$J$$$?$a$G$9!%e(B  
|  
|e$B$^$!!$%3%s%Q%$%k$G$-$J$$$N$G$OOC$K$J$i$J$$$N$G!$e(B  
|e$B$H$j$”$($:$O;H$($k5!G=$G\<BAu$7$F$\*$/$7$+$J$$$N$G$7$g$&$M$'!%!%!%e(B

e$B$^$"!“CY$/$F:$$k$J$i;H$C$F$\_$l$P$9$02r$k$H;W$&$N$G!”$=$N;~$Ke(B  
e$BO"Mm$7$F$/$@$5$$!#JL$K0UCO0-$r$7$?$$$o$1$8$c$J$$$s$G!#e(B

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 5, 2006, 12:17pm UTC](https://www.ruby-forum.com/t/ext-tk-tkutil/67496/8 "2006-09-05T12:17:57Z")

</div>

e$B1J0fe(B@e$BCNG=!%6e9)Bg$G$9!%e(B

From: Yukihiro M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [ruby-dev:29489] Re: ext/tk/tkutil  
Date: Tue, 5 Sep 2006 15:19:53 +0900  
Message-ID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> e$B$^$"!“CY$/$F:$$k$J$i;H$C$F$\_$l$P$9$02r$k$H;W$&$N$G!”$=$N;~$Ke(B  
> e$BO"Mm$7$F$/$@$5$$!#JL$K0UCO0-$r$7$?$$$o$1$8$c$J$$$s$G!#e(B

e$BN;2r$G$9!%e(B  
e$B!VCY$/$J$C$?!W$HJ86g$,=P$J$$$J$i!$e(B  
e$B5$$K$9$k$[$I$N$3$H$G$O$J$$$N$G$7$g$&!%e(B(^\_^)

# e$B%3%\_%C%H$r$\*4j$$$7$^$9e(B \> e$B$J$+$@$5$se(B
