[Groonga-commit] groonga/groonga at 778e631 [master] Extract grn_scan_info_build implementation in C as a function

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Apr 8 15:19:28 JST 2016


Kouhei Sutou	2016-04-08 15:19:28 +0900 (Fri, 08 Apr 2016)

  New Revision: 778e631ba7346e796955f082936f34d9bf1882b1
  https://github.com/groonga/groonga/commit/778e631ba7346e796955f082936f34d9bf1882b1

  Message:
    Extract grn_scan_info_build implementation in C as a function

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+20 -12)
===================================================================
--- lib/expr.c    2016-04-07 21:57:58 +0900 (45c2dc2)
+++ lib/expr.c    2016-04-08 15:19:28 +0900 (2d49b02)
@@ -4496,9 +4496,9 @@ scan_info_build_match(grn_ctx *ctx, scan_info *si)
   }
 }
 
-scan_info **
-grn_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
-                    grn_operator op, grn_bool record_exist)
+static scan_info **
+grn_scan_info_build_full(grn_ctx *ctx, grn_obj *expr, int *n,
+                         grn_operator op, grn_bool record_exist)
 {
   grn_obj *var;
   scan_stat stat;
@@ -4506,15 +4506,7 @@ grn_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
   scan_info **sis, *si = NULL;
   grn_expr_code *c, *ce;
   grn_expr *e = (grn_expr *)expr;
-#ifdef GRN_WITH_MRUBY
-  grn_ctx_impl_mrb_ensure_init(ctx);
-  if (ctx->rc != GRN_SUCCESS) {
-    return NULL;
-  }
-  if (ctx->impl->mrb.state) {
-    return grn_mrb_scan_info_build(ctx, expr, n, op, record_exist);
-  }
-#endif
+
   if (!(var = grn_expr_get_var_by_offset(ctx, expr, 0))) { return NULL; }
   for (stat = SCAN_START, c = e->codes, ce = &e->codes[e->codes_curr]; c < ce; c++) {
     switch (c->op) {
@@ -4864,6 +4856,22 @@ grn_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
   return sis;
 }
 
+scan_info **
+grn_scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
+                    grn_operator op, grn_bool record_exist)
+{
+#ifdef GRN_WITH_MRUBY
+  grn_ctx_impl_mrb_ensure_init(ctx);
+  if (ctx->rc != GRN_SUCCESS) {
+    return NULL;
+  }
+  if (ctx->impl->mrb.state) {
+    return grn_mrb_scan_info_build(ctx, expr, n, op, record_exist);
+  }
+#endif
+  return grn_scan_info_build_full(ctx, expr, n, op, record_exist);
+}
+
 void
 grn_inspect_scan_info_list(grn_ctx *ctx, grn_obj *buffer, scan_info **sis, int n)
 {
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index