[Groonga-commit] groonga/groonga at f69eddc [master] Fix a bug causing malfunction of grn_pat_del().

Back to archive index

Daijiro MORI null+****@clear*****
Wed Apr 22 18:47:14 JST 2015


Daijiro MORI	2015-04-22 18:47:14 +0900 (Wed, 22 Apr 2015)

  New Revision: f69eddc47b29a7ab6dae9f87485efacb9b8731f1
  https://github.com/groonga/groonga/commit/f69eddc47b29a7ab6dae9f87485efacb9b8731f1

  Message:
    Fix a bug causing malfunction of grn_pat_del().

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+20 -12)
===================================================================
--- lib/pat.c    2015-04-22 18:32:08 +0900 (c5dacc0)
+++ lib/pat.c    2015-04-22 18:47:14 +0900 (e24dbe7)
@@ -1137,14 +1137,18 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
     di->stat = DL_PHASE2;
     di->d = r;
     if (otherside) {
-      PAT_AT(pat, otherside, rno);
-      if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
-        if (!delinfo_search(pat, otherside)) {
-          GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
+      if (otherside == r) {
+        otherside = 0;
+      } else {
+        PAT_AT(pat, otherside, rno);
+        if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
+          if (!delinfo_search(pat, otherside)) {
+            GRN_LOG(ctx, GRN_LOG_DEBUG, "no delinfo found %d", otherside);
+          }
+          PAT_CHK_SET(rno, 0);
         }
-        PAT_CHK_SET(rno, 0);
+        if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
       }
-      if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
     }
     *p0 = otherside;
   } else {
@@ -1201,14 +1205,18 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
       if (proot == p0 && !rn0->check) { rn0->lr[0] = rn0->lr[1] = otherside; }
     } else {
       if (otherside) {
-        PAT_AT(pat, otherside, rno);
-        if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
-          if (!delinfo_search(pat, otherside)) {
-            GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
+        if (otherside == r) {
+          otherside = 0;
+        } else {
+          PAT_AT(pat, otherside, rno);
+          if (rno && c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
+            if (!delinfo_search(pat, otherside)) {
+              GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
+            }
+            PAT_CHK_SET(rno, 0);
           }
-          PAT_CHK_SET(rno, 0);
+          if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
         }
-        if (proot == p0 && !rno->check) { rno->lr[0] = rno->lr[1] = otherside; }
       }
       *p0 = otherside;
     }
-------------- next part --------------
HTML����������������������������...
Download 



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