[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][TOP]

Re: g_hash_table_destroy ()の説明に誤訳


了解です。
前述の指摘部分とこの部分の訳文を修正してみます。

2004-12-08 (水) の 22:11 +0900 に Yasumichi Akahoshi さんは書きました:
>  既存のキーがあった場合の動作についてglib-2.4.6の該当部分を見てみると
> 
> g_hash_table_insert ():
>       /* free the passed key */
>       if (hash_table->key_destroy_func)
>         hash_table->key_destroy_func (key);
> 
>       if (hash_table->value_destroy_func)
>         hash_table->value_destroy_func ((*node)->value);
> 
>       (*node)->value = value;
> 
> g_hash_table_replace ():
>       if (hash_table->key_destroy_func)
>         hash_table->key_destroy_func ((*node)->key);
> 
>       if (hash_table->value_destroy_func)
>         hash_table->value_destroy_func ((*node)->value);
> 
>       (*node)->key   = key;
>       (*node)->value = value;
> 
> となっており、前者がg_hash_table_insertに渡されたkeyを解放しようとするの
> に対し、後者が既存のnodeのkeyを解放するという違いがあり、それがthe
> passed keyとthe old keyの違いになっているようです。その辺の違いが訳文に
> 出ていない様ですので明確にした方が良さそうです。文案としては、
> 
> g_hash_table_insert ():
> …GHashTable を生成する際に key_destroy_func を指定した場合、その関数を
> 使って(g_hash_table_insertに)渡されたkeyを解放します。
> 
> g_hash_table_replace ():
> …GHashTable を生成する際に key_destroy_func を指定した場合、その関数を
> 使って古いキーを解放します。
> 
> の様な感じでしょうか。
> 
-- 
(相花)