Kouhei Sutou
null+****@clear*****
Thu Jan 14 18:16:43 JST 2016
Kouhei Sutou 2016-01-14 18:16:43 +0900 (Thu, 14 Jan 2016) New Revision: c13b49cf53e6787fa97f755516b64066da77252a https://github.com/groonga/groonga/commit/c13b49cf53e6787fa97f755516b64066da77252a Message: hash: add error description Modified files: lib/hash.c Modified: lib/hash.c (+19 -2) =================================================================== --- lib/hash.c 2016-01-14 18:12:03 +0900 (ed107e5) +++ lib/hash.c 2016-01-14 18:16:43 +0900 (4999e40) @@ -1474,7 +1474,15 @@ grn_io_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash, header = hash->header.common; if (key_size >= GRN_HASH_SEGMENT_SIZE) { - return GRN_INVALID_ARGUMENT; + char name[GRN_TABLE_MAX_KEY_SIZE]; + int name_size; + name_size = grn_hash_name(ctx, hash, name, GRN_TABLE_MAX_KEY_SIZE); + ERR(GRN_INVALID_ARGUMENT, + "[hash][key][put] too long key: <%.*s>: max=%u: key size=%u", + name_size, name, + GRN_HASH_SEGMENT_SIZE, + key_size); + return ctx->rc; } if (key_size > (GRN_HASH_KEY_MAX_TOTAL_SIZE - header->curr_key)) { char name[GRN_TABLE_MAX_KEY_SIZE]; @@ -1501,7 +1509,16 @@ grn_io_hash_entry_put_key(grn_ctx *ctx, grn_hash *hash, { void * const key_ptr = grn_io_hash_key_at(ctx, hash, key_offset); if (!key_ptr) { - return GRN_NO_MEMORY_AVAILABLE; + char name[GRN_TABLE_MAX_KEY_SIZE]; + int name_size; + name_size = grn_hash_name(ctx, hash, name, GRN_TABLE_MAX_KEY_SIZE); + ERR(GRN_NO_MEMORY_AVAILABLE, + "[hash][key][put] failed to allocate for new key: <%.*s>: " + "new offset:%u key size=%u", + name_size, name, + key_offset, + key_size); + return ctx->rc; } grn_memcpy(key_ptr, key, key_size); } -------------- next part -------------- HTML����������������������������...Télécharger