[Groonga-commit] groonga/groonga at 9809a25 [master] Add grn_token_reset() internal API

Back to archive index

Kouhei Sutou null+****@clear*****
Wed May 9 14:17:55 JST 2018


Kouhei Sutou	2018-05-09 14:17:55 +0900 (Wed, 09 May 2018)

  New Revision: 9809a2556f4f3a56f7e77758fab2fc348b13e6cd
  https://github.com/groonga/groonga/commit/9809a2556f4f3a56f7e77758fab2fc348b13e6cd

  Message:
    Add grn_token_reset() internal API

  Modified files:
    lib/grn_token.h
    lib/token.c

  Modified: lib/grn_token.h (+1 -0)
===================================================================
--- lib/grn_token.h    2018-05-09 14:17:13 +0900 (fa128e13f)
+++ lib/grn_token.h    2018-05-09 14:17:55 +0900 (7ba2a3afb)
@@ -33,6 +33,7 @@ struct _grn_token {
 
 grn_rc grn_token_init(grn_ctx *ctx, grn_token *token);
 grn_rc grn_token_fin(grn_ctx *ctx, grn_token *token);
+grn_rc grn_token_reset(grn_ctx *ctx, grn_token *token);
 grn_rc grn_token_copy(grn_ctx *ctx, grn_token *token, grn_token *source);
 
 #ifdef __cplusplus

  Modified: lib/token.c (+17 -0)
===================================================================
--- lib/token.c    2018-05-09 14:17:13 +0900 (8a70d7f65)
+++ lib/token.c    2018-05-09 14:17:55 +0900 (b1599f85c)
@@ -170,6 +170,23 @@ grn_token_set_source_length(grn_ctx *ctx,
 exit:
   GRN_API_RETURN(ctx->rc);
 }
+
+grn_rc
+grn_token_reset(grn_ctx *ctx, grn_token *token)
+{
+  GRN_API_ENTER;
+  if (!token) {
+    ERR(GRN_INVALID_ARGUMENT, "[token][reset] token must not be NULL");
+    goto exit;
+  }
+  GRN_BULK_REWIND(&(token->data));
+  token->status = GRN_TOKEN_CONTINUE;
+  token->source_offset = 0;
+  token->source_length = 0;
+exit:
+  GRN_API_RETURN(ctx->rc);
+}
+
 grn_rc
 grn_token_copy(grn_ctx *ctx,
                grn_token *token,
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180509/3008ae6f/attachment.htm 



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