Kouhei Sutou
null+****@clear*****
Fri Feb 21 11:58:20 JST 2014
Kouhei Sutou 2014-02-21 11:58:20 +0900 (Fri, 21 Feb 2014) New Revision: 7e36d6f8d661272c1d01e529a650e87d4cf3ee90 https://github.com/groonga/groonga/commit/7e36d6f8d661272c1d01e529a650e87d4cf3ee90 Message: Add internal predicate macro for forward index column for readability Modified files: lib/db.c lib/db.h lib/proc.c Modified: lib/db.c (+1 -1) =================================================================== --- lib/db.c 2014-02-21 11:43:24 +0900 (bec88ff) +++ lib/db.c 2014-02-21 11:58:20 +0900 (33c48e1) @@ -5679,7 +5679,7 @@ grn_obj_set_value_column_index(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_id range_id; grn_obj *range; - if (DB_OBJ(obj)->source_size > 0) { + if (!GRN_OBJ_FORWARD_INDEX_COLUMNP(obj)) { char column_name[GRN_TABLE_MAX_KEY_SIZE]; int column_name_size; column_name_size = grn_obj_name(ctx, obj, column_name, Modified: lib/db.h (+5 -0) =================================================================== --- lib/db.h 2014-02-21 11:43:24 +0900 (bf7c5f5) +++ lib/db.h 2014-02-21 11:58:20 +0900 (bf8f572) @@ -143,6 +143,11 @@ struct _grn_type { (GRN_TABLE_HASH_KEY <= ((grn_db_obj *)obj)->header.type) &&\ (((grn_db_obj *)obj)->header.type <= GRN_DB)) +#define GRN_OBJ_FORWARD_INDEX_COLUMNP(obj) \ + (obj &&\ + DB_OBJ(obj)->header.type == GRN_COLUMN_INDEX &&\ + DB_OBJ(obj)->source_size == 0) + typedef grn_rc grn_selector_func(grn_ctx *ctx, grn_obj *table, grn_obj *index, int nargs, grn_obj **args, grn_obj *res, grn_operator op); Modified: lib/proc.c (+3 -3) =================================================================== --- lib/proc.c 2014-02-21 11:43:24 +0900 (df84662) +++ lib/proc.c 2014-02-21 11:58:20 +0900 (de1c302) @@ -2363,7 +2363,7 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table) GRN_TEXT_INIT(&column_name, 0); for (i = 0; i < ncolumns; i++) { if (columns[i]->header.type == GRN_COLUMN_INDEX && - DB_OBJ(columns[i])->source_size > 0) { + !GRN_OBJ_FORWARD_INDEX_COLUMNP(columns[i])) { continue; } GRN_BULK_REWIND(&column_name); @@ -2466,8 +2466,8 @@ dump_records(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table) } break; case GRN_OBJ_COLUMN_INDEX: - if (DB_OBJ(column)->source_size == 0) { - dump_record_column_forward_index(ctx, outbuf, id, column); + if (GRN_OBJ_FORWARD_INDEX_COLUMNP(column)) { + dump_record_column_forward_index(ctx, outbuf, id, column); } break; default: -------------- next part -------------- HTML����������������������������...Download