null+****@clear*****
null+****@clear*****
2010年 10月 13日 (水) 20:21:08 JST
Daijiro MORI 2010-10-13 11:21:08 +0000 (Wed, 13 Oct 2010)
New Revision: 6e5c0fd6fab85ff0ed65467a8a83cf82143f176c
Log:
Clear key_size in _grn_table_key() when the return value is NULL.
Modified files:
lib/db.c
Modified: lib/db.c (+6 -2)
===================================================================
--- lib/db.c 2010-10-13 11:03:35 +0000 (113e26a)
+++ lib/db.c 2010-10-13 11:21:08 +0000 (c443e84)
@@ -2699,9 +2699,13 @@ _grn_table_key(grn_ctx *ctx, grn_obj *table, grn_id id, uint32_t *key_size)
case GRN_TABLE_NO_KEY :
{
grn_array *a = (grn_array *)table;
- if (a->obj.header.domain && a->value_size) {
+ const char *v;
+ if (a->obj.header.domain && a->value_size &&
+ (v = _grn_array_get_value(ctx, a, id))) {
*key_size = a->value_size;
- return _grn_array_get_value(ctx, a, id);
+ return v;
+ } else {
+ *key_size = 0;
}
}
break;