[Groonga-commit] groonga/groonga at f7bfe4e [master] Disable extension with msgpack-c < 1

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Tue Apr 3 22:31:24 JST 2018


Kouhei Sutou	2018-04-03 22:31:24 +0900 (Tue, 03 Apr 2018)

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

  Message:
    Disable extension with msgpack-c < 1

  Modified files:
    include/groonga/msgpack.h
    lib/grn_msgpack.h
    lib/msgpack.c

  Modified: include/groonga/msgpack.h (+2 -0)
===================================================================
--- include/groonga/msgpack.h    2018-04-03 18:24:08 +0900 (16484ecf8)
+++ include/groonga/msgpack.h    2018-04-03 22:31:24 +0900 (b5c1727f0)
@@ -40,8 +40,10 @@ grn_rc grn_msgpack_pack(grn_ctx *ctx,
 grn_rc grn_msgpack_unpack_array(grn_ctx *ctx,
                                 msgpack_object_array *array,
                                 grn_obj *vector);
+# if MSGPACK_VERSION_MAJOR < 1
 int64_t grn_msgpack_unpack_ext_time(grn_ctx *ctx,
                                     msgpack_object_ext *ext);
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
 
 #ifdef __cplusplus
 }

  Modified: lib/grn_msgpack.h (+3 -1)
===================================================================
--- lib/grn_msgpack.h    2018-04-03 18:24:08 +0900 (256ce09f7)
+++ lib/grn_msgpack.h    2018-04-03 22:31:24 +0900 (68e5423e2)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2009-2016 Brazil
+  Copyright(C) 2009-2018 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -63,8 +63,10 @@ grn_rc grn_msgpack_pack_internal(grn_ctx *ctx,
 grn_rc grn_msgpack_unpack_array_internal(grn_ctx *ctx,
                                          msgpack_object_array *array,
                                          grn_obj *vector);
+# if MSGPACK_VERSION_MAJOR < 1
 int64_t grn_msgpack_unpack_ext_time_internal(grn_ctx *ctx,
                                              msgpack_object_ext *ext);
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
 
 
 #endif /* GRN_WITH_MESSAGE_PACK */

  Modified: lib/msgpack.c (+10 -0)
===================================================================
--- lib/msgpack.c    2018-04-03 18:24:08 +0900 (70fb27276)
+++ lib/msgpack.c    2018-04-03 22:31:24 +0900 (a1f3af7f2)
@@ -75,9 +75,13 @@ grn_msgpack_pack_raw_internal(grn_ctx *ctx,
     msgpack_pack_double(packer, *((double *)(value)));
     break;
   case GRN_DB_TIME :
+# if MSGPACK_VERSION_MAJOR < 1
+    msgpack_pack_int64(packer, *((int64_t *)value));
+# else /* MSGPACK_VERSION_MAJOR < 1 */
     /* TODO: Use timestamp time in spec. */
     msgpack_pack_ext(packer, sizeof(int64_t), GRN_MSGPACK_OBJECT_EXT_TIME);
     msgpack_pack_ext_body(packer, value, sizeof(int64_t));
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
     break;
   case GRN_DB_SHORT_TEXT :
   case GRN_DB_TEXT :
@@ -182,6 +186,7 @@ grn_msgpack_unpack_array_internal(grn_ctx *ctx,
                              0,
                              GRN_DB_TEXT);
       break;
+# if MSGPACK_VERSION_MAJOR < 1
     case MSGPACK_OBJECT_EXT :
       if (element->via.ext.type == GRN_MSGPACK_OBJECT_EXT_TIME) {
         grn_vector_add_element(ctx,
@@ -196,6 +201,7 @@ grn_msgpack_unpack_array_internal(grn_ctx *ctx,
             element->via.ext.type);
       }
       break;
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
     default :
       ERR(GRN_INVALID_ARGUMENT,
           "[msgpack] unexpected element type: <%#x>",
@@ -207,6 +213,7 @@ grn_msgpack_unpack_array_internal(grn_ctx *ctx,
   return ctx->rc;
 }
 
+# if MSGPACK_VERSION_MAJOR < 1
 int64_t
 grn_msgpack_unpack_ext_time_internal(grn_ctx *ctx,
                                      msgpack_object_ext *ext)
@@ -221,6 +228,7 @@ grn_msgpack_unpack_ext_time_internal(grn_ctx *ctx,
     return 0;
   }
 }
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
 
 grn_rc
 grn_msgpack_pack_raw(grn_ctx *ctx,
@@ -254,6 +262,7 @@ grn_msgpack_unpack_array(grn_ctx *ctx,
   GRN_API_RETURN(ctx->rc);
 }
 
+# if MSGPACK_VERSION_MAJOR < 1
 int64_t
 grn_msgpack_unpack_ext_time(grn_ctx *ctx,
                             msgpack_object_ext *ext)
@@ -263,4 +272,5 @@ grn_msgpack_unpack_ext_time(grn_ctx *ctx,
   time = grn_msgpack_unpack_ext_time_internal(ctx, ext);
   GRN_API_RETURN(time);
 }
+# endif /* MSGPACK_VERSION_MAJOR < 1 */
 #endif /* GRN_WITH_MESSAGE_PACK */
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180403/28158ba2/attachment-0001.htm 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る