Kouhei Sutou
null+****@clear*****
Wed Apr 13 11:20:41 JST 2016
Kouhei Sutou 2016-04-13 11:20:41 +0900 (Wed, 13 Apr 2016) New Revision: d1f762453107cee1e2f0e224f5d80b4490b08c3a https://github.com/groonga/groonga/commit/d1f762453107cee1e2f0e224f5d80b4490b08c3a Message: pat: use 0 as the initial key size It's for returning correct key size when pat has no record. It doesn't break the existing behavior. Before: -1 (the old initial key size) is overflowed and reset in key_put(). -1 becomes 0. After: 0 (the new initial key size) isn't overflowed and reset in key_put(). 0 is still 0. Added files: test/command/suite/object_inspect/table/no_record/dat_key.expected test/command/suite/object_inspect/table/no_record/dat_key.test test/command/suite/object_inspect/table/no_record/hash_key.expected test/command/suite/object_inspect/table/no_record/hash_key.test test/command/suite/object_inspect/table/no_record/no_key.expected test/command/suite/object_inspect/table/no_record/no_key.test test/command/suite/object_inspect/table/no_record/pat_key.expected test/command/suite/object_inspect/table/no_record/pat_key.test Modified files: lib/pat.c Modified: lib/pat.c (+1 -1) =================================================================== --- lib/pat.c 2016-04-13 11:06:54 +0900 (aa7caf6) +++ lib/pat.c 2016-04-13 11:20:41 +0900 (9fbdac8) @@ -493,7 +493,7 @@ _grn_pat_create(grn_ctx *ctx, grn_pat *pat, header->value_size = value_size; header->n_entries = 0; header->curr_rec = 0; - header->curr_key = -1; + header->curr_key = 0; header->curr_del = 0; header->curr_del2 = 0; header->curr_del3 = 0; Added: test/command/suite/object_inspect/table/no_record/dat_key.expected (+31 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/dat_key.expected 2016-04-13 11:20:41 +0900 (86c8768) @@ -0,0 +1,31 @@ +table_create Users TABLE_DAT_KEY ShortText +[[0,0.0,0.0],true] +object_inspect Users +[ + [ + 0, + 0.0, + 0.0 + ], + { + "id": 256, + "name": "Users", + "type": { + "id": 50, + "name": "table:dat_key" + }, + "key": { + "type": { + "id": 14, + "name": "ShortText", + "type": { + "id": 32, + "name": "type" + }, + "size": 4096 + } + }, + "value": null, + "n_records": 0 + } +] Added: test/command/suite/object_inspect/table/no_record/dat_key.test (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/dat_key.test 2016-04-13 11:20:41 +0900 (e1261c6) @@ -0,0 +1,3 @@ +table_create Users TABLE_DAT_KEY ShortText + +object_inspect Users Added: test/command/suite/object_inspect/table/no_record/hash_key.expected (+43 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/hash_key.expected 2016-04-13 11:20:41 +0900 (bc37faf) @@ -0,0 +1,43 @@ +table_create Users TABLE_HASH_KEY ShortText Int32 +[[0,0.0,0.0],true] +object_inspect Users +[ + [ + 0, + 0.0, + 0.0 + ], + { + "id": 256, + "name": "Users", + "type": { + "id": 48, + "name": "table:hash_key" + }, + "key": { + "type": { + "id": 14, + "name": "ShortText", + "type": { + "id": 32, + "name": "type" + }, + "size": 4096 + }, + "total_size": 0, + "max_total_size": 4294967295 + }, + "value": { + "type": { + "id": 8, + "name": "Int32", + "type": { + "id": 32, + "name": "type" + }, + "size": 4 + } + }, + "n_records": 0 + } +] Added: test/command/suite/object_inspect/table/no_record/hash_key.test (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/hash_key.test 2016-04-13 11:20:41 +0900 (e16daf0) @@ -0,0 +1,3 @@ +table_create Users TABLE_HASH_KEY ShortText Int32 + +object_inspect Users Added: test/command/suite/object_inspect/table/no_record/no_key.expected (+31 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/no_key.expected 2016-04-13 11:20:41 +0900 (c523250) @@ -0,0 +1,31 @@ +table_create Points TABLE_NO_KEY --value_type WGS84GeoPoint +[[0,0.0,0.0],true] +object_inspect Points +[ + [ + 0, + 0.0, + 0.0 + ], + { + "id": 256, + "name": "Points", + "type": { + "id": 51, + "name": "table:no_key" + }, + "key": null, + "value": { + "type": { + "id": 18, + "name": "WGS84GeoPoint", + "type": { + "id": 32, + "name": "type" + }, + "size": 8 + } + }, + "n_records": 0 + } +] Added: test/command/suite/object_inspect/table/no_record/no_key.test (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/no_key.test 2016-04-13 11:20:41 +0900 (e95bf73) @@ -0,0 +1,3 @@ +table_create Points TABLE_NO_KEY --value_type WGS84GeoPoint + +object_inspect Points Added: test/command/suite/object_inspect/table/no_record/pat_key.expected (+43 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/pat_key.expected 2016-04-13 11:20:41 +0900 (1c7f4f9) @@ -0,0 +1,43 @@ +table_create Users TABLE_PAT_KEY ShortText Time +[[0,0.0,0.0],true] +object_inspect Users +[ + [ + 0, + 0.0, + 0.0 + ], + { + "id": 256, + "name": "Users", + "type": { + "id": 49, + "name": "table:pat_key" + }, + "key": { + "type": { + "id": 14, + "name": "ShortText", + "type": { + "id": 32, + "name": "type" + }, + "size": 4096 + }, + "total_size": 0, + "max_total_size": 4294967294 + }, + "value": { + "type": { + "id": 13, + "name": "Time", + "type": { + "id": 32, + "name": "type" + }, + "size": 8 + } + }, + "n_records": 0 + } +] Added: test/command/suite/object_inspect/table/no_record/pat_key.test (+3 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/object_inspect/table/no_record/pat_key.test 2016-04-13 11:20:41 +0900 (9a74850) @@ -0,0 +1,3 @@ +table_create Users TABLE_PAT_KEY ShortText Time + +object_inspect Users -------------- next part -------------- HTML����������������������������...Download