[Groonga-commit] groonga/groonga at d1c6ddd [master] Use "have_overlap"

Back to archive index

Kouhei Sutou null+****@clear*****
Fri May 11 15:15:41 JST 2018


Kouhei Sutou	2018-05-11 15:15:41 +0900 (Fri, 11 May 2018)

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

  Message:
    Use "have_overlap"

  Modified files:
    include/groonga/token.h
    lib/grn_token.h
    lib/highlighter.c
    lib/token.c

  Modified: include/groonga/token.h (+3 -3)
===================================================================
--- include/groonga/token.h    2018-05-11 15:10:16 +0900 (5dc45a4f2)
+++ include/groonga/token.h    2018-05-11 15:15:41 +0900 (1f21c14f2)
@@ -147,12 +147,12 @@ grn_token_set_source_length(grn_ctx *ctx,
                             grn_token *token,
                             uint32_t length);
 GRN_API grn_bool
-grn_token_is_overlap(grn_ctx *ctx,
-                     grn_token *token);
+grn_token_have_overlap(grn_ctx *ctx,
+                       grn_token *token);
 GRN_API grn_rc
 grn_token_set_overlap(grn_ctx *ctx,
                       grn_token *token,
-                      grn_bool is_overlap);
+                      grn_bool have_overlap);
 
 #ifdef __cplusplus
 }  /* extern "C" */

  Modified: lib/grn_token.h (+1 -1)
===================================================================
--- lib/grn_token.h    2018-05-11 15:10:16 +0900 (5d256a396)
+++ lib/grn_token.h    2018-05-11 15:15:41 +0900 (13847c9b7)
@@ -29,7 +29,7 @@ struct _grn_token {
   grn_token_status status;
   uint64_t source_offset;
   uint32_t source_length;
-  grn_bool is_overlap;
+  grn_bool have_overlap;
 };
 
 grn_rc grn_token_init(grn_ctx *ctx, grn_token *token);

  Modified: lib/highlighter.c (+5 -5)
===================================================================
--- lib/highlighter.c    2018-05-11 15:10:16 +0900 (650f87043)
+++ lib/highlighter.c    2018-05-11 15:15:41 +0900 (c8a6632f5)
@@ -25,7 +25,7 @@
 typedef struct {
   uint64_t offset;
   uint32_t length;
-  grn_bool is_overlapping;
+  grn_bool have_overlap;
   uint8_t first_character_length;
 } grn_highlighter_location;
 
@@ -342,7 +342,7 @@ grn_highlighter_highlight_lexicon(grn_ctx *ctx,
     GRN_RECORD_PUT(ctx, token_ids, token_id);
     location.offset = grn_token_get_source_offset(ctx, token);
     location.length = grn_token_get_source_length(ctx, token);
-    location.is_overlapping = grn_token_is_overlap(ctx, token);
+    location.have_overlap = grn_token_have_overlap(ctx, token);
     {
       const char *data;
       size_t data_length;
@@ -385,7 +385,7 @@ grn_highlighter_highlight_lexicon(grn_ctx *ctx,
         _grn_pat_key(ctx, chunks, chunk_id, &key_size);
         n_ids = key_size / sizeof(grn_id);
         candidate.offset = first->offset;
-        if (first->is_overlapping && n_ids > 1) {
+        if (first->have_overlap && n_ids > 1) {
           candidate.length = first->first_character_length;
         } else {
           candidate.length = first->length;
@@ -395,12 +395,12 @@ grn_highlighter_highlight_lexicon(grn_ctx *ctx,
           grn_highlighter_location *previous = current - 1;
           uint32_t current_length;
           uint32_t previous_length;
-          if (current->is_overlapping && j + 1 < n_ids) {
+          if (current->have_overlap && j + 1 < n_ids) {
             current_length = current->first_character_length;
           } else {
             current_length = current->length;
           }
-          if (previous->is_overlapping && j + 1 < n_ids) {
+          if (previous->have_overlap && j + 1 < n_ids) {
             previous_length = previous->first_character_length;
           } else {
             previous_length = previous->length;

  Modified: lib/token.c (+9 -9)
===================================================================
--- lib/token.c    2018-05-11 15:10:16 +0900 (abbac818d)
+++ lib/token.c    2018-05-11 15:15:41 +0900 (e047dd30d)
@@ -26,7 +26,7 @@ grn_token_init(grn_ctx *ctx, grn_token *token)
   token->status = GRN_TOKEN_CONTINUE;
   token->source_offset = 0;
   token->source_length = 0;
-  token->is_overlap = GRN_FALSE;
+  token->have_overlap = GRN_FALSE;
   GRN_API_RETURN(ctx->rc);
 }
 
@@ -173,29 +173,29 @@ exit:
 }
 
 grn_bool
-grn_token_is_overlap(grn_ctx *ctx, grn_token *token)
+grn_token_have_overlap(grn_ctx *ctx, grn_token *token)
 {
   GRN_API_ENTER;
   if (!token) {
     ERR(GRN_INVALID_ARGUMENT,
-        "[token][overlap][get] token must not be NULL");
+        "[token][overlap][have] token must not be NULL");
     GRN_API_RETURN(0);
   }
-  GRN_API_RETURN(token->is_overlap);
+  GRN_API_RETURN(token->have_overlap);
 }
 
 grn_rc
 grn_token_set_overlap(grn_ctx *ctx,
                       grn_token *token,
-                      grn_bool is_overlap)
+                      grn_bool have_overlap)
 {
   GRN_API_ENTER;
   if (!token) {
     ERR(GRN_INVALID_ARGUMENT,
-        "[token][overlap][set] token must not be NULL");
+        "[token][overlapping][set] token must not be NULL");
     goto exit;
   }
-  token->is_overlap = is_overlap;
+  token->have_overlap = have_overlap;
 exit:
   GRN_API_RETURN(ctx->rc);
 }
@@ -212,7 +212,7 @@ grn_token_reset(grn_ctx *ctx, grn_token *token)
   token->status = GRN_TOKEN_CONTINUE;
   token->source_offset = 0;
   token->source_length = 0;
-  token->is_overlap = GRN_FALSE;
+  token->have_overlap = GRN_FALSE;
 exit:
   GRN_API_RETURN(ctx->rc);
 }
@@ -234,7 +234,7 @@ grn_token_copy(grn_ctx *ctx,
   token->status = source->status;
   token->source_offset = source->source_offset;
   token->source_length = source->source_length;
-  token->is_overlap = source->is_overlap;
+  token->have_overlap = source->have_overlap;
 exit:
   GRN_API_RETURN(ctx->rc);
 }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180511/eb696f8e/attachment-0001.htm 



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