[Groonga-commit] groonga/groonga at 7c2c68b [master] Add grn_token_copy() convenient internal API

Back to archive index

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


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

  New Revision: 7c2c68bf1acecc91e018fe7c25774b34a53133b5
  https://github.com/groonga/groonga/commit/7c2c68bf1acecc91e018fe7c25774b34a53133b5

  Message:
    Add grn_token_copy() convenient 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 10:14:32 +0900 (b65c21e28)
+++ lib/grn_token.h    2018-05-09 10:14:55 +0900 (f0c38880f)
@@ -31,6 +31,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_copy(grn_ctx *ctx, grn_token *token, grn_token *source);
 
 #ifdef __cplusplus
 }

  Modified: lib/token.c (+19 -0)
===================================================================
--- lib/token.c    2018-05-09 10:14:32 +0900 (9f1482568)
+++ lib/token.c    2018-05-09 10:14:55 +0900 (808bf48f6)
@@ -107,3 +107,22 @@ grn_token_set_status(grn_ctx *ctx,
 exit:
   GRN_API_RETURN(ctx->rc);
 }
+
+grn_rc
+grn_token_copy(grn_ctx *ctx,
+               grn_token *token,
+               grn_token *source)
+{
+  GRN_API_ENTER;
+  if (!token) {
+    ERR(GRN_INVALID_ARGUMENT, "[token][copy] token must not be NULL");
+    goto exit;
+  }
+  GRN_TEXT_SET(ctx,
+               &(token->data),
+               GRN_TEXT_VALUE(&(source->data)),
+               GRN_TEXT_LEN(&(source->data)));
+  token->status = source->status;
+exit:
+  GRN_API_RETURN(ctx->rc);
+}
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180509/324977fb/attachment.htm 



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