まつもと ゆきひろです
In message "[ruby-list:8803] Re: ruby 1.1c0 released"
on 98/07/21, TANAKA Shin-ichi <tanaka / sp.mmlab.toshiba.co.jp> writes:
|東芝の田中です。
|> した.うちでは再現しないんですよね.web2がないので適当なファ
|> イルで試したのがいけないのかも.SEGVしたst_lookupの中で
|> (gdb) p *table
|> した結果とか,その上のsearch_methodで
|> (gdb) p *(struct RClass*)klass
|> した結果とかを見せて頂けませんか?
|
|もっと簡単な再現パタン(1つのスクリプトで閉じているような)を
|作れればいいのでしょうけど・・・
|
|とりあえず構造体の中身を印刷してみました。
|よろしくお願いいたします。
その後の調査もあってなんとなく原因が解ったように思います.ん
で,パッチです.これでどうでしょう.[ruby-list:8791]をあてた
後にこれをあてて下さい.
--- st.c 1998/07/21 09:18:00 1.1.1.1.4.2
+++ st.c 1998/07/22 01:21:58
@@ -224,3 +223,3 @@
{
- register st_table_entry *ptr, *next, **old_bins = table->bins;
+ register st_table_entry *ptr, *next, **new_bins;
int i, old_num_bins = table->num_bins, new_num_bins, hash_val;
@@ -233,5 +232,3 @@
- table->num_bins = 0;
- table->num_entries = 0;
- table->bins = (st_table_entry **)
+ new_bins = (st_table_entry **)
Calloc((unsigned)new_num_bins, sizeof(st_table_entry*));
@@ -239,9 +236,8 @@
for(i = 0; i < old_num_bins ; i++) {
- ptr = old_bins[i];
- while (ptr != nil(st_table_entry)) {
+ ptr = table->bins[i];
+ while (ptr != 0) {
next = ptr->next;
hash_val = do_hash2(ptr->key, table, new_num_bins);
- ptr->next = table->bins[hash_val];
- table->bins[hash_val] = ptr;
- table->num_entries++;
+ ptr->next = new_bins[hash_val];
+ new_bins[hash_val] = ptr;
ptr = next;
@@ -249,4 +245,5 @@
}
+ free(table->bins);
table->num_bins = new_num_bins;
- free((char*)old_bins);
+ table->bins = new_bins;
}