[Groonga-commit] groonga/groonga [master] fixed a problem which makes unable to find an entry corresponding to the root node

Back to archive index

null+****@clear***** null+****@clear*****
2011年 12月 18日 (日) 20:47:14 JST


Daijiro MORI	2011-12-18 11:47:14 +0000 (Sun, 18 Dec 2011)

  New Revision: e3c8d9030da5f42e42a0829b64de43ee39886665

  Log:
    fixed a problem which makes unable to find an entry corresponding to the root node

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+5 -2)
===================================================================
--- lib/pat.c    2011-12-14 09:22:24 +0000 (84ffbbb)
+++ lib/pat.c    2011-12-18 11:47:14 +0000 (dfe17dd)
@@ -1014,12 +1014,13 @@ __grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, in
   pat_node *rn, *rn0 = NULL, *rno;
   int c, c0 = -1, ch;
   uint32_t len = key_size * 16;
-  grn_id r, otherside, *p, *p0 = NULL;
+  grn_id r, otherside, *proot, *p, *p0 = NULL;
+
   di = delinfo_new(ctx, pat); /* must be called before find rn */
   di->shared = shared;
   PAT_AT(pat, 0, rn);
   c = -1;
-  p = &rn->lr[1];
+  proot = p = &rn->lr[1];
   for (;;) {
     if (!(r = *p)) { return GRN_INVALID_ARGUMENT; }
     PAT_AT(pat, r, rn);
@@ -1059,6 +1060,7 @@ __grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, in
         }
         PAT_CHK_SET(rno, 0);
       }
+      if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
     }
     *p0 = otherside;
   } else {
@@ -1121,6 +1123,7 @@ __grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, in
           }
           PAT_CHK_SET(rno, 0);
         }
+        if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
       }
       *p0 = otherside;
     }




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