morita
morit****@razil*****
2008年 7月 7日 (月) 14:31:25 JST
森です。いつもご指摘ありがとうございます。
手直ししてみました! そしてIはIOのIです!
Kouhei Sutou さんは書きました:
> 須藤です。
>
> キーサイズがuint32_tでIHP()が真なハッシュ(IはIOのI?)に対して
> sen_hash_delete_by_id()をすると落ちます。
>
> sen_ctx *context;
> sen_hash *hash;
> uint32_t key;
> sen_table_search_flags flags;
> sen_id id;
>
> context = sen_ctx_open(NULL, SEN_CTX_USEQL);
> hash = sen_hash_create(context, "/tmp/xxx", sizeof(uint32_t), 64,
> 0, sen_enc_default);
>
> key = 29;
> flags = SEN_TABLE_ADD;
> id = sen_hash_lookup(hash, &key, sizeof(uint32_t), NULL, &flags);
> sen_hash_delete_by_id(hash, id);
>
> とりあえず、これで落ちなくなるのですが、これでいいかどうかは
> わかりません。。。
>
> Index: lib/hash.c
> ===================================================================
> --- lib/hash.c (リビジョン 914)
> +++ lib/hash.c (作業コピー)
> @@ -650,8 +650,10 @@
> if (IHP(hash)) {
> uint32_t size = ee->size - 1;
> struct sen_hash_header *hh = hash->header;
> - ee->key = hh->garbages[size];
> - hh->garbages[size] = id;
> + if (ee->size != 0) {
> + ee->key = hh->garbages[size];
> + hh->garbages[size] = id;
> + }
> } else {
> ee->key = hash->garbages;
> hash->garbages = id;
>
> _______________________________________________
> Senna-dev mailing list
> Senna****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/senna-dev
> バグ報告方法:http://qwik.jp/senna/bug_report.html
>
>