[Groonga-commit] groonga/groonga at 5e4b836 [master] mrb: use MRB_INT64 in bindings

Back to archive index

Kouhei Sutou null+****@clear*****
Fri May 13 18:12:05 JST 2016


Kouhei Sutou	2016-05-13 18:12:05 +0900 (Fri, 13 May 2016)

  New Revision: 5e4b83653a35f73b1f1cc13ffc918b227c245ab9
  https://github.com/groonga/groonga/commit/5e4b83653a35f73b1f1cc13ffc918b227c245ab9

  Message:
    mrb: use MRB_INT64 in bindings

  Modified files:
    CMakeLists.txt
    configure.ac
    lib/CMakeLists.txt
    lib/mrb/Makefile.am
    lib/mrb/mrb_column.c
    lib/mrb/mrb_command.c
    lib/mrb/mrb_ctx.c
    lib/mrb/mrb_expr.c
    lib/mrb/mrb_logger.c
    lib/mrb/mrb_query_logger.c
    lib/mrb/mrb_writer.c
    vendor/mruby/CMakeLists.txt
    vendor/mruby/Makefile.am

  Modified: CMakeLists.txt (+1 -0)
===================================================================
--- CMakeLists.txt    2016-05-13 17:29:41 +0900 (cc893ac)
+++ CMakeLists.txt    2016-05-13 18:12:05 +0900 (9a6f912)
@@ -600,6 +600,7 @@ else()
   set(MRUBY_INCLUDE_DIRS "")
   set(MRUBY_LIBS "")
 endif()
+set(MRUBY_DEFINITIONS "-DMRB_INT64")
 
 # TODO: Support using system Onigmo instead of bundled Onigmo.
 set(GRN_WITH_ONIGMO ON)

  Modified: configure.ac (+3 -0)
===================================================================
--- configure.ac    2016-05-13 17:29:41 +0900 (03045a6)
+++ configure.ac    2016-05-13 18:12:05 +0900 (860c703)
@@ -1556,6 +1556,9 @@ fi
 AC_SUBST(MRUBY_CFLAGS)
 AM_CONDITIONAL(WITH_MRUBY, test "$enable_mruby" = "yes")
 
+MRUBY_CPPFLAGS="-DMRB_INT64"
+AC_SUBST(MRUBY_CPPFLAGS)
+
 # This option is used in vendor/onigmo/configure
 AC_ARG_ENABLE(shared-onigmo,
   [AS_HELP_STRING([--enable-shared-onigmo],

  Modified: lib/CMakeLists.txt (+4 -0)
===================================================================
--- lib/CMakeLists.txt    2016-05-13 17:29:41 +0900 (a564d34)
+++ lib/CMakeLists.txt    2016-05-13 18:12:05 +0900 (03104b0)
@@ -58,6 +58,10 @@ set_source_files_properties(
   ${LIBGROONGA_METADATA_SOURCES}
   PROPERTIES
   COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
+set_source_files_properties(
+  ${LIBGRNMRB_SOURCES}
+  PROPERTIES
+  COMPILE_DEFINITIONS "${MRUBY_DEFINITIONS}")
 set_source_files_properties(dat.cpp ${LIBGRNDAT_SOURCES}
   PROPERTIES
   COMPILE_FLAGS "${GRN_CXX_COMPILE_FLAGS}")

  Modified: lib/mrb/Makefile.am (+2 -1)
===================================================================
--- lib/mrb/Makefile.am    2016-05-13 17:29:41 +0900 (13b4aeb)
+++ lib/mrb/Makefile.am    2016-05-13 18:12:05 +0900 (0e4db63)
@@ -4,7 +4,8 @@ SUBDIRS =					\
 AM_CPPFLAGS =					\
 	-I$(top_builddir)			\
 	-I$(top_srcdir)/include			\
-	-I$(top_srcdir)/lib
+	-I$(top_srcdir)/lib			\
+	$(MRUBY_CPPFLAGS)
 
 AM_CFLAGS =					\
 	$(NO_STRICT_ALIASING_CFLAGS)		\

  Modified: lib/mrb/mrb_column.c (+1 -1)
===================================================================
--- lib/mrb/mrb_column.c    2016-05-13 17:29:41 +0900 (a6eeba0)
+++ lib/mrb/mrb_column.c    2016-05-13 18:12:05 +0900 (ed21ff7)
@@ -33,7 +33,7 @@ mrb_grn_column_array_reference(mrb_state *mrb, mrb_value self)
 {
   grn_ctx *ctx = (grn_ctx *)mrb->ud;
   grn_obj *column;
-  grn_id record_id;
+  mrb_int record_id;
   grn_obj *column_value;
 
   column = DATA_PTR(self);

  Modified: lib/mrb/mrb_command.c (+1 -1)
===================================================================
--- lib/mrb/mrb_command.c    2016-05-13 17:29:41 +0900 (28dd08c)
+++ lib/mrb/mrb_command.c    2016-05-13 18:12:05 +0900 (802012e)
@@ -100,7 +100,7 @@ mrb_grn_command_run_wrapper(grn_ctx *ctx,
       ERR(GRN_COMMAND_ERROR,
           "failed to run command: <%*.s>: %.*s",
           name_size, name,
-          RSTRING_LEN(reason), RSTRING_PTR(reason));
+          (int)RSTRING_LEN(reason), RSTRING_PTR(reason));
     }
   }
   mrb_gc_arena_restore(mrb, arena_index);

  Modified: lib/mrb/mrb_ctx.c (+1 -1)
===================================================================
--- lib/mrb/mrb_ctx.c    2016-05-13 17:29:41 +0900 (b3d278c)
+++ lib/mrb/mrb_ctx.c    2016-05-13 18:12:05 +0900 (180ace2)
@@ -196,7 +196,7 @@ ctx_set_error_message(mrb_state *mrb, mrb_value self)
 
   mrb_get_args(mrb, "S", &error_message);
   grn_ctx_log(ctx, "%.*s",
-              RSTRING_LEN(error_message),
+              (int)RSTRING_LEN(error_message),
               RSTRING_PTR(error_message));
 
   return error_message;

  Modified: lib/mrb/mrb_expr.c (+12 -12)
===================================================================
--- lib/mrb/mrb_expr.c    2016-05-13 17:29:41 +0900 (76e8df2)
+++ lib/mrb/mrb_expr.c    2016-05-13 18:12:05 +0900 (eef6256)
@@ -104,11 +104,11 @@ mrb_grn_scan_info_put_index(mrb_state *mrb, mrb_value self)
   grn_ctx *ctx = (grn_ctx *)mrb->ud;
   scan_info *si;
   mrb_value mrb_index;
-  int sid;
-  int32_t weight;
+  mrb_int sid;
+  mrb_int weight;
   mrb_value mrb_scorer;
   mrb_value mrb_scorer_args_expr;
-  int32_t scorer_args_expr_offset;
+  mrb_int scorer_args_expr_offset;
   grn_obj *index;
   grn_obj *scorer = NULL;
   grn_obj *scorer_args_expr = NULL;
@@ -162,7 +162,7 @@ static mrb_value
 mrb_grn_scan_info_set_end(mrb_state *mrb, mrb_value self)
 {
   scan_info *si;
-  int end;
+  mrb_int end;
 
   mrb_get_args(mrb, "i", &end);
   si = DATA_PTR(self);
@@ -190,7 +190,7 @@ static mrb_value
 mrb_grn_scan_info_set_flags(mrb_state *mrb, mrb_value self)
 {
   scan_info *si;
-  int flags;
+  mrb_int flags;
 
   mrb_get_args(mrb, "i", &flags);
   si = DATA_PTR(self);
@@ -238,7 +238,7 @@ static mrb_value
 mrb_grn_scan_info_set_max_interval(mrb_state *mrb, mrb_value self)
 {
   scan_info *si;
-  int max_interval;
+  mrb_int max_interval;
 
   mrb_get_args(mrb, "i", &max_interval);
   si = DATA_PTR(self);
@@ -261,7 +261,7 @@ static mrb_value
 mrb_grn_scan_info_set_similarity_threshold(mrb_state *mrb, mrb_value self)
 {
   scan_info *si;
-  int similarity_threshold;
+  mrb_int similarity_threshold;
 
   mrb_get_args(mrb, "i", &similarity_threshold);
   si = DATA_PTR(self);
@@ -285,7 +285,7 @@ mrb_grn_scan_info_get_arg(mrb_state *mrb, mrb_value self)
 {
   grn_ctx *ctx = (grn_ctx *)mrb->ud;
   scan_info *si;
-  int index;
+  mrb_int index;
   grn_obj *arg;
 
   mrb_get_args(mrb, "i", &index);
@@ -326,7 +326,7 @@ static mrb_value
 mrb_grn_scan_info_set_start_position(mrb_state *mrb, mrb_value self)
 {
   scan_info *si;
-  int start_position;
+  mrb_int start_position;
 
   mrb_get_args(mrb, "i", &start_position);
   si = DATA_PTR(self);
@@ -650,7 +650,7 @@ mrb_grn_expression_append_object(mrb_state *mrb, mrb_value self)
   grn_obj *object;
   mrb_value mrb_op;
   grn_operator op;
-  int n_args;
+  mrb_int n_args;
 
   expr = DATA_PTR(self);
   mrb_get_args(mrb, "ooi", &mrb_object, &mrb_op, &n_args);
@@ -671,7 +671,7 @@ mrb_grn_expression_append_constant(mrb_state *mrb, mrb_value self)
   mrb_value mrb_constant;
   mrb_value mrb_op;
   grn_operator op;
-  int n_args;
+  mrb_int n_args;
 
   expr = DATA_PTR(self);
   mrb_get_args(mrb, "ooi", &mrb_constant, &mrb_op, &n_args);
@@ -765,7 +765,7 @@ mrb_grn_expression_append_operator(mrb_state *mrb, mrb_value self)
   grn_ctx *ctx = (grn_ctx *)mrb->ud;
   grn_obj *expr;
   mrb_value mrb_op;
-  int n_args;
+  mrb_int n_args;
   grn_operator op;
 
   expr = DATA_PTR(self);

  Modified: lib/mrb/mrb_logger.c (+2 -1)
===================================================================
--- lib/mrb/mrb_logger.c    2016-05-13 17:29:41 +0900 (884ca76)
+++ lib/mrb/mrb_logger.c    2016-05-13 18:12:05 +0900 (fd5e5fb)
@@ -52,7 +52,8 @@ logger_log(mrb_state *mrb, mrb_value self)
 
   mrb_get_args(mrb, "izizs",
                &level, &file, &line, &method, &message, &message_size);
-  grn_logger_put(ctx, level, file, line, method, "%.*s", message_size, message);
+  grn_logger_put(ctx, level, file, line, method,
+                 "%.*s", (int)message_size, message);
 
   return self;
 }

  Modified: lib/mrb/mrb_query_logger.c (+2 -1)
===================================================================
--- lib/mrb/mrb_query_logger.c    2016-05-13 17:29:41 +0900 (5e4f4fd)
+++ lib/mrb/mrb_query_logger.c    2016-05-13 18:12:05 +0900 (b2f5e79)
@@ -49,7 +49,8 @@ query_logger_log_raw(mrb_state *mrb, mrb_value self)
   mrb_int message_size;
 
   mrb_get_args(mrb, "izs", &flag, &mark, &message, &message_size);
-  grn_query_logger_put(ctx, flag, mark, "%.*s", message_size, message);
+  grn_query_logger_put(ctx, flag, mark,
+                       "%.*s", (int)message_size, message);
 
   return self;
 }

  Modified: lib/mrb/mrb_writer.c (+1 -1)
===================================================================
--- lib/mrb/mrb_writer.c    2016-05-13 17:29:41 +0900 (b2c706a)
+++ lib/mrb/mrb_writer.c    2016-05-13 18:12:05 +0900 (20ebd6a)
@@ -213,7 +213,7 @@ static mrb_value
 writer_set_content_type(mrb_state *mrb, mrb_value self)
 {
   grn_ctx *ctx = (grn_ctx *)mrb->ud;
-  grn_content_type content_type;
+  mrb_int content_type;
 
   mrb_get_args(mrb, "i", &content_type);
 

  Modified: vendor/mruby/CMakeLists.txt (+1 -1)
===================================================================
--- vendor/mruby/CMakeLists.txt    2016-05-13 17:29:41 +0900 (45ff927)
+++ vendor/mruby/CMakeLists.txt    2016-05-13 18:12:05 +0900 (601464f)
@@ -87,7 +87,7 @@ if(GRN_WITH_MRUBY)
       "${MRUBY_C_COMPILE_FLAGS} -Wno-bad-function-cast")
   endif()
   add_definitions(
-    "-DMRB_INT64"
+    ${MRUBY_DEFINITIONS}
     )
   if(WIN32)
     add_definitions(

  Modified: vendor/mruby/Makefile.am (+1 -1)
===================================================================
--- vendor/mruby/Makefile.am    2016-05-13 17:29:41 +0900 (7d79424)
+++ vendor/mruby/Makefile.am    2016-05-13 18:12:05 +0900 (9731aa7)
@@ -26,7 +26,7 @@ noinst_LTLIBRARIES = libmruby.la
 
 AM_CPPFLAGS =					\
 	-I$(srcdir)/../onigmo-source		\
-	-DMRB_INT64
+	$(MRUBY_CPPFLAGS)
 
 if PLATFORM_WIN32
 AM_CPPFLAGS +=					\
-------------- next part --------------
HTML����������������������������...
下载 



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