[Groonga-commit] groonga/groonga [master] Stopped accessing e->vars from scan_info_build().

Back to archive index

null+****@clear***** null+****@clear*****
2010年 6月 15日 (火) 23:32:12 JST


Daijiro MORI	2010-06-15 14:32:12 +0000 (Tue, 15 Jun 2010)

  New Revision: ba116fb89c3d7f7521f9a0869bac18f4eade84ea

  Log:
    Stopped accessing e->vars from scan_info_build().

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+4 -3)
===================================================================
--- lib/expr.c    2010-06-15 11:54:04 +0000 (09bb924)
+++ lib/expr.c    2010-06-15 14:32:12 +0000 (2ee0f9a)
@@ -687,11 +687,11 @@ grn_expr_get_or_add_var(grn_ctx *ctx, grn_obj *expr, const char *name, unsigned
   grn_hash *vars = grn_expr_get_vars(ctx, expr, &n);
   if (vars) {
     int added = 0;
-    char name_buf[256];
+    char name_buf[16];
     if (!name_size) {
       char *rest;
       name_buf[0] = '$';
-      grn_itoa((int)GRN_HASH_SIZE(vars) + 1, name_buf + 1, name_buf + 256, &rest);
+      grn_itoa((int)GRN_HASH_SIZE(vars) + 1, name_buf + 1, name_buf + 16, &rest);
       name_size = rest - name_buf;
       name = name_buf;
     }
@@ -3403,7 +3403,8 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
   int i, m = 0, o = 0;
   scan_info **sis, *si = NULL;
   grn_expr_code *c, *ce;
-  grn_expr *e = (grn_expr *)expr;  if (!e->nvars || !(var = &e->vars[0].value)) { return NULL; }
+  grn_expr *e = (grn_expr *)expr;
+  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) {
     case GRN_OP_MATCH :




Groonga-commit メーリングリストの案内
Back to archive index