[Groonga-commit] groonga/groonga at 2de50ad [master] grn_pat: update comments

Back to archive index

susumu.yata null+****@clear*****
Thu Oct 29 11:39:11 JST 2015


susumu.yata	2015-10-29 11:39:11 +0900 (Thu, 29 Oct 2015)

  New Revision: 2de50ad49a0b373791dca99b09117656255b3641
  https://github.com/groonga/groonga/commit/2de50ad49a0b373791dca99b09117656255b3641

  Message:
    grn_pat: update comments
    
    GitHub: #421

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+14 -2)
===================================================================
--- lib/pat.c    2015-10-29 09:24:47 +0900 (fa0a779)
+++ lib/pat.c    2015-10-29 11:39:11 +0900 (5daa52c)
@@ -1200,13 +1200,17 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
     di->d = r;
     if (otherside) {
       if (c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
-        /* rno is an output node and will be a non-output node. */
+        /* To keep rno as an output node, its check is set to zero. */
         if (!delinfo_search(pat, otherside)) {
           GRN_LOG(ctx, GRN_LOG_DEBUG, "no delinfo found %d", otherside);
         }
         PAT_CHK_SET(rno, 0);
       }
       if (proot == p0 && !rno->check) {
+        /*
+         * Update rno->lr because the first node, rno becomes the new first
+         * node, is not an output node even if its check is zero.
+         */
         const uint8_t *k = pat_node_get_key(ctx, pat, rno);
         int direction = k ? (*k >> 7) : 1;
         rno->lr[direction] = otherside;
@@ -1278,6 +1282,10 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
       /* The previous node (*p0) has a self-loop (rn0 == rno). */
       PAT_CHK_SET(rno, 0);
       if (proot == p0) {
+        /*
+         * Update rno->lr because the first node, rno becomes the new first
+         * node, is not an output node even if its check is zero.
+         */
         const uint8_t *k = pat_node_get_key(ctx, pat, rno);
         int direction = k ? (*k >> 7) : 1;
         rno->lr[direction] = otherside;
@@ -1286,13 +1294,17 @@ _grn_pat_del(grn_ctx *ctx, grn_pat *pat, const char *key, uint32_t key_size, int
     } else {
       if (otherside) {
         if (c0 < PAT_CHK(rno) && PAT_CHK(rno) <= c) {
-          /* rno is an output node and will be a non-output node. */
+          /* To keep rno as an output node, its check is set to zero. */
           if (!delinfo_search(pat, otherside)) {
             GRN_LOG(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
           }
           PAT_CHK_SET(rno, 0);
         }
         if (proot == p0 && !rno->check) {
+          /*
+           * Update rno->lr because the first node, rno becomes the new first
+           * node, is not an output node even if its check is zero.
+           */
           const uint8_t *k = pat_node_get_key(ctx, pat, rno);
           int direction = k ? (*k >> 7) : 1;
           rno->lr[direction] = otherside;
-------------- next part --------------
HTML����������������������������...
Download 



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