[Groonga-commit] groonga/groonga at 6193f0e [master] Close related functions

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Aug 10 12:07:43 JST 2014


Kouhei Sutou	2014-08-10 12:07:43 +0900 (Sun, 10 Aug 2014)

  New Revision: 6193f0e60c82d0ac4a7390009ae709830946274a
  https://github.com/groonga/groonga/commit/6193f0e60c82d0ac4a7390009ae709830946274a

  Message:
    Close related functions

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+41 -41)
===================================================================
--- lib/expr.c    2014-08-10 12:04:27 +0900 (4569923)
+++ lib/expr.c    2014-08-10 12:07:43 +0900 (afeb6a0)
@@ -6818,6 +6818,47 @@ grn_expr_parser_close(grn_ctx *ctx)
 }
 
 grn_rc
+grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *got_keywords)
+{
+  int i, n;
+  scan_info **sis, *si;
+  GRN_API_ENTER;
+  if ((sis = scan_info_build(ctx, expr, &n, GRN_OP_OR, 0))) {
+    int butp = 0, nparens = 0, npbut = 0;
+    grn_obj but_stack;
+    GRN_UINT32_INIT(&but_stack, GRN_OBJ_VECTOR);
+    for (i = n; i--;) {
+      si = sis[i];
+      if (si->flags & SCAN_POP) {
+        nparens++;
+        if (si->logical_op == GRN_OP_AND_NOT) {
+          GRN_UINT32_PUT(ctx, &but_stack, npbut);
+          npbut = nparens;
+          butp = 1 - butp;
+        }
+      } else {
+        if (si->op == GRN_OP_MATCH && si->query) {
+          if (butp == (si->logical_op == GRN_OP_AND_NOT)) {
+            GRN_PTR_PUT(ctx, got_keywords, si->query);
+          }
+        }
+        if (si->flags & SCAN_PUSH) {
+          if (nparens == npbut) {
+            butp = 1 - butp;
+            GRN_UINT32_POP(&but_stack, npbut);
+          }
+          nparens--;
+        }
+      }
+    }
+    GRN_OBJ_FIN(ctx, &but_stack);
+    for (i = n; i--;) { SI_FREE(sis[i]); }
+    GRN_FREE(sis);
+  }
+  GRN_API_RETURN(GRN_SUCCESS);
+}
+
+grn_rc
 grn_expr_snip_add_conditions(grn_ctx *ctx, grn_obj *expr, grn_obj *snip,
                              unsigned int n_tags,
                              const char **opentags, unsigned int *opentag_lens,
@@ -7000,44 +7041,3 @@ grn_expr_syntax_escape_query(grn_ctx *ctx, const char *query, int query_size,
                                 target_characters, GRN_QUERY_ESCAPE,
                                 escaped_query);
 }
-
-grn_rc
-grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *got_keywords)
-{
-  int i, n;
-  scan_info **sis, *si;
-  GRN_API_ENTER;
-  if ((sis = scan_info_build(ctx, expr, &n, GRN_OP_OR, 0))) {
-    int butp = 0, nparens = 0, npbut = 0;
-    grn_obj but_stack;
-    GRN_UINT32_INIT(&but_stack, GRN_OBJ_VECTOR);
-    for (i = n; i--;) {
-      si = sis[i];
-      if (si->flags & SCAN_POP) {
-        nparens++;
-        if (si->logical_op == GRN_OP_AND_NOT) {
-          GRN_UINT32_PUT(ctx, &but_stack, npbut);
-          npbut = nparens;
-          butp = 1 - butp;
-        }
-      } else {
-        if (si->op == GRN_OP_MATCH && si->query) {
-          if (butp == (si->logical_op == GRN_OP_AND_NOT)) {
-            GRN_PTR_PUT(ctx, got_keywords, si->query);
-          }
-        }
-        if (si->flags & SCAN_PUSH) {
-          if (nparens == npbut) {
-            butp = 1 - butp;
-            GRN_UINT32_POP(&but_stack, npbut);
-          }
-          nparens--;
-        }
-      }
-    }
-    GRN_OBJ_FIN(ctx, &but_stack);
-    for (i = n; i--;) { SI_FREE(sis[i]); }
-    GRN_FREE(sis);
-  }
-  GRN_API_RETURN(GRN_SUCCESS);
-}
-------------- next part --------------
HTML����������������������������...
下載 



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