[Groonga-commit] ranguba/rroonga at 7e9faeb [master] Use rb_to_symbol for Ruby string -> Ruby symbol

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Sep 29 22:41:59 JST 2014


Kouhei Sutou	2014-09-29 22:41:59 +0900 (Mon, 29 Sep 2014)

  New Revision: 7e9faebcf7abbd14164e0e76d87b56b1ed401eca
  https://github.com/ranguba/rroonga/commit/7e9faebcf7abbd14164e0e76d87b56b1ed401eca

  Message:
    Use rb_to_symbol for Ruby string -> Ruby symbol
    
    It is for symbol GC. But! Rroonga doesn't generate symbols
    dynamically. All symbols used in Rroonga are static. So we don't need to
    add code for symbol GC. Sorry...

  Modified files:
    ext/groonga/extconf.rb
    ext/groonga/rb-grn.h

  Modified: ext/groonga/extconf.rb (+2 -2)
===================================================================
--- ext/groonga/extconf.rb    2014-09-29 22:35:15 +0900 (795a54b)
+++ ext/groonga/extconf.rb    2014-09-29 22:41:59 +0900 (d848668)
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 #
-# Copyright (C) 2009-2013  Kouhei Sutou <kou �� clear-code.com>
+# Copyright (C) 2009-2014  Kouhei Sutou <kou �� clear-code.com>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -269,7 +269,7 @@ $defs << "-DGRN_MICRO_VERSION=#{real_micro}"
 have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
 have_func("rb_errinfo", "ruby.h")
 have_func("rb_sym2str", "ruby.h")
-have_func("rb_id2sym", "ruby.h")
+have_func("rb_to_string", "ruby.h")
 have_type("enum ruby_value_type", "ruby.h")
 
 checking_for(checking_message("--enable-debug-log option")) do

  Modified: ext/groonga/rb-grn.h (+3 -3)
===================================================================
--- ext/groonga/rb-grn.h    2014-09-29 22:35:15 +0900 (65889d5)
+++ ext/groonga/rb-grn.h    2014-09-29 22:41:59 +0900 (4aab392)
@@ -44,8 +44,8 @@
 #  define rb_sym2str(symbol) (rb_id2str(SYM2ID(symbol)))
 #endif
 
-#ifndef HAVE_RB_ID2SYM
-#  define rb_id2sym(name) (ID2SYM(name))
+#ifndef HAVE_RB_TO_SYMBOL
+#  define rb_to_symbol(rb_string) (rb_str_intern(rb_string))
 #endif
 
 #include <groonga.h>
@@ -599,7 +599,7 @@ VALUE          rb_grn_column_expression_builder_build
                                                     (VALUE self);
 
 
-#define RB_GRN_INTERN(string)         (rb_str_intern(rb_str_new2(string)))
+#define RB_GRN_INTERN(c_string)       (rb_to_symbol(rb_str_new2(c_string)))
 
 #define RVAL2CBOOL(object)            (RTEST(object))
 #define CBOOL2RVAL(boolean)           ((boolean) ? Qtrue : Qfalse)
-------------- next part --------------
HTML����������������������������...
Download 



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