Kouhei Sutou
null+****@clear*****
Fri Aug 26 17:44:00 JST 2016
Kouhei Sutou 2016-08-07 17:25:47 +0900 (Sun, 07 Aug 2016) New Revision: f92b8ea9ef908a25d983055b3a682241cf11f1f9 https://github.com/groonga/groonga/commit/f92b8ea9ef908a25d983055b3a682241cf11f1f9 Message: Put selector function to callbacks union Modified files: lib/db.c lib/expr.c lib/grn_db.h lib/obj.c Modified: lib/db.c (+0 -1) =================================================================== --- lib/db.c 2016-08-05 10:43:11 +0900 (2fce415) +++ lib/db.c 2016-08-07 17:25:47 +0900 (42ea5b4) @@ -909,7 +909,6 @@ grn_proc_create(grn_ctx *ctx, const char *name, int name_size, grn_proc_type typ res->funcs[PROC_INIT] = init; res->funcs[PROC_NEXT] = next; res->funcs[PROC_FIN] = fin; - res->selector = NULL; memset(&(res->callbacks), 0, sizeof(res->callbacks)); GRN_TEXT_INIT(&res->name_buf, 0); res->vars = NULL; Modified: lib/expr.c (+15 -5) =================================================================== --- lib/expr.c 2016-08-05 10:43:11 +0900 (66da510) +++ lib/expr.c 2016-08-07 17:25:47 +0900 (e1015ce) @@ -211,7 +211,7 @@ grn_proc_set_selector(grn_ctx *ctx, grn_obj *proc, grn_selector_func selector) if (!grn_obj_is_function_proc(ctx, proc)) { return GRN_INVALID_ARGUMENT; } - proc_->selector = selector; + proc_->callbacks.function.selector = selector; return GRN_SUCCESS; } @@ -6627,8 +6627,13 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si, "[selector][%s]", proc_name); grn_table_select_index_report(ctx, tag, index); } - rc = proc->selector(ctx, table, index, si->nargs, si->args, - res, si->logical_op); + rc = proc->callbacks.function.selector(ctx, + table, + index, + si->nargs, + si->args, + res, + si->logical_op); if (rc) { /* TODO: report error */ } else { @@ -6664,8 +6669,13 @@ grn_table_select_index(grn_ctx *ctx, grn_obj *table, scan_info *si, "[selector][no-index][%s]", proc_name); grn_table_select_index_report(ctx, tag, table); } - rc = proc->selector(ctx, table, NULL, si->nargs, si->args, - res, si->logical_op); + rc = proc->callbacks.function.selector(ctx, + table, + NULL, + si->nargs, + si->args, + res, + si->logical_op); if (rc) { if (rc == GRN_FUNCTION_NOT_IMPLEMENTED) { ERRCLR(ctx); Modified: lib/grn_db.h (+3 -2) =================================================================== --- lib/grn_db.h 2016-08-05 10:43:11 +0900 (aa29d61) +++ lib/grn_db.h 2016-08-07 17:25:47 +0900 (ad8cd13) @@ -183,10 +183,11 @@ struct _grn_proc { grn_proc_type type; grn_proc_func *funcs[3]; - grn_selector_func *selector; - union { struct { + grn_selector_func *selector; + } function; + struct { grn_command_run_func *run; } command; struct { Modified: lib/obj.c (+1 -1) =================================================================== --- lib/obj.c 2016-08-05 10:43:11 +0900 (3cbd079) +++ lib/obj.c 2016-08-07 17:25:47 +0900 (1ce0a16) @@ -246,7 +246,7 @@ grn_obj_is_selector_proc(grn_ctx *ctx, grn_obj *obj) } proc = (grn_proc *)obj; - return proc->selector != NULL; + return proc->callbacks.function.selector != NULL; } grn_bool -------------- next part -------------- HTML����������������������������... Download