[Groonga-commit] groonga/groonga at 0d212ec [master] Add internal function grn_content_type_parse

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 3 16:11:54 JST 2017


Kouhei Sutou	2017-02-03 16:11:54 +0900 (Fri, 03 Feb 2017)

  New Revision: 0d212ec94dd2c76c833ebf88a9477f35bc84cdd7
  https://github.com/groonga/groonga/commit/0d212ec94dd2c76c833ebf88a9477f35bc84cdd7

  Message:
    Add internal function grn_content_type_parse
    
    It will replaces grn_get_ctype() soon.

  Modified files:
    lib/ctx.c
    lib/grn_ctx.h

  Modified: lib/ctx.c (+9 -1)
===================================================================
--- lib/ctx.c    2017-02-03 16:09:05 +0900 (517ba28)
+++ lib/ctx.c    2017-02-03 16:11:54 +0900 (dd3ce12)
@@ -876,7 +876,15 @@ grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold)
 grn_content_type
 grn_get_ctype(grn_obj *var)
 {
-  grn_content_type ct = GRN_CONTENT_JSON;
+  return grn_content_type_parse(NULL, var, GRN_CONTENT_JSON);
+}
+
+grn_content_type
+grn_content_type_parse(grn_ctx *ctx,
+                       grn_obj *var,
+                       grn_content_type default_value)
+{
+  grn_content_type ct = default_value;
   if (var->header.domain == GRN_DB_INT32) {
     ct = GRN_INT32_VALUE(var);
   } else if (GRN_TEXT_LEN(var)) {

  Modified: lib/grn_ctx.h (+3 -0)
===================================================================
--- lib/grn_ctx.h    2017-02-03 16:09:05 +0900 (f540c7b)
+++ lib/grn_ctx.h    2017-02-03 16:11:54 +0900 (604fd98)
@@ -436,6 +436,9 @@ GRN_API grn_rc grn_ctx_sendv(grn_ctx *ctx, int argc, char **argv, int flags);
 void grn_ctx_set_keep_command(grn_ctx *ctx, grn_obj *command);
 
 grn_content_type grn_get_ctype(grn_obj *var);
+grn_content_type grn_content_type_parse(grn_ctx *ctx,
+                                        grn_obj *var,
+                                        grn_content_type default_value);
 
 /**** db_obj ****/
 
-------------- next part --------------
HTML����������������������������...
Download 



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