[ruby-oci8-commit] [242] trunk/ruby-oci8: * ext/oci8/extconf.rb: add checking code for intern. h, util.h,

nobody at rubyforge.org nobody at rubyforge.org
Tue Jan 15 10:52:14 EST 2008


Revision: 242
Author:   kubo
Date:     2008-01-15 10:52:14 -0500 (Tue, 15 Jan 2008)

Log Message:
-----------
* ext/oci8/extconf.rb: add checking code for intern.h, util.h,
    ruby/util.h, ruby_errinfo and rb_errinfo.
* ext/oci8/env.c: define a header file to be included by
    HAVE_RUBY_UTIL_H and HAVE_UTIL_H, not by RUBY_VM.
* ext/oci8/oci8.h: define a header file to be included by
    HAVE_INTERN_H, not by RUBY_VM. use HAVE_RB_ERRINFO and
    HAVE_RUBY_ERRINFO to define rb_errinfo() as a macro.
* ext/oci8/oci8.c: use rb_eval_string() instead of rb_reg_new()
    for not to use RUBY_VM.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/env.c
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/ext/oci8/oci8.c
    trunk/ruby-oci8/ext/oci8/oci8.h

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2008-01-14 15:44:44 UTC (rev 241)
+++ trunk/ruby-oci8/ChangeLog	2008-01-15 15:52:14 UTC (rev 242)
@@ -1,4 +1,15 @@
 2008-01-14  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/extconf.rb: add checking code for intern.h, util.h,
+	    ruby/util.h, ruby_errinfo and rb_errinfo.
+	* ext/oci8/env.c: define a header file to be included by
+	    HAVE_RUBY_UTIL_H and HAVE_UTIL_H, not by RUBY_VM.
+	* ext/oci8/oci8.h: define a header file to be included by
+	    HAVE_INTERN_H, not by RUBY_VM. use HAVE_RB_ERRINFO and
+	    HAVE_RUBY_ERRINFO to define rb_errinfo() as a macro.
+	* ext/oci8/oci8.c: use rb_eval_string() instead of rb_reg_new()
+	    for not to use RUBY_VM.
+
+2008-01-14  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/oci8.h ext/oci8/oci8lib.c: rename variable name
 	    cOCIHandle to oci8_cOCIHandle to use outside of oci8lib.c.
 	* ext/oci8/metadata.c: use oci8_cOCIHandle instead of rb_cObject

Modified: trunk/ruby-oci8/ext/oci8/env.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/env.c	2008-01-14 15:44:44 UTC (rev 241)
+++ trunk/ruby-oci8/ext/oci8/env.c	2008-01-15 15:52:14 UTC (rev 242)
@@ -8,9 +8,10 @@
 #include "oci8.h"
 
 /* ruby_setenv */
-#ifdef RUBY_VM
+#ifdef HAVE_RUBY_UTIL_H
 #include <ruby/util.h>
-#else
+#endif
+#ifdef HAVE_UTIL_H
 #include <util.h>
 #endif
 

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2008-01-14 15:44:44 UTC (rev 241)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2008-01-15 15:52:14 UTC (rev 242)
@@ -69,6 +69,16 @@
 
 have_func("localtime_r")
 
+# ruby 1.8 headers
+have_header("intern.h")
+have_header("util.h")
+# ruby 1.9 headers
+have_header("ruby/util.h")
+
+# $! in C API
+have_var("ruby_errinfo", "ruby.h") # ruby 1.8
+have_func("rb_errinfo", "ruby.h")  # ruby 1.9
+
 # replace files
 replace = {
   'OCI8_CLIENT_VERSION' => oraconf.version,

Modified: trunk/ruby-oci8/ext/oci8/oci8.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.c	2008-01-14 15:44:44 UTC (rev 241)
+++ trunk/ruby-oci8/ext/oci8/oci8.c	2008-01-15 15:52:14 UTC (rev 242)
@@ -61,16 +61,12 @@
 static ID id_at_username;
 static ID id_set_prefetch_rows;
 
-#define CONN_STR_REGEX "^([^(\\s|\\@)]*)\\/([^(\\s|\\@)]*)(?:\\@(\\S+))?(?:\\s+as\\s+(\\S*)\\s*)?$"
+#define CONN_STR_REGEX "/^([^(\\s|\\@)]*)\\/([^(\\s|\\@)]*)(?:\\@(\\S+))?(?:\\s+as\\s+(\\S*)\\s*)?$/i"
 static void oci8_do_parse_connect_string(VALUE conn_str, VALUE *user, VALUE *pass, VALUE *dbname, VALUE *mode)
 {
     static VALUE re = Qnil;
     if (NIL_P(re)) {
-#ifdef RUBY_VM
-        re = rb_reg_new(rb_str_new2(CONN_STR_REGEX), FIX2INT(rb_eval_string("Regexp::IGNORECASE")));
-#else
-        re = rb_reg_new(CONN_STR_REGEX, strlen(CONN_STR_REGEX), FIX2INT(rb_eval_string("Regexp::IGNORECASE")));
-#endif
+        re = rb_eval_string(CONN_STR_REGEX);
         rb_global_variable(&re);
     }
     StringValue(conn_str);

Modified: trunk/ruby-oci8/ext/oci8/oci8.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.h	2008-01-14 15:44:44 UTC (rev 241)
+++ trunk/ruby-oci8/ext/oci8/oci8.h	2008-01-15 15:52:14 UTC (rev 242)
@@ -9,7 +9,7 @@
 
 #include "ruby.h"
 #include "rubyio.h"
-#ifndef RUBY_VM
+#ifdef HAVE_INTERN_H
 #include "intern.h"
 #endif
 
@@ -58,7 +58,7 @@
 #define RFLOAT_VALUE(obj) RFLOAT(obj)->value
 #endif
 
-#ifndef RUBY_VM
+#if !defined(HAVE_RB_ERRINFO) && defined(HAVE_RUBY_ERRINFO)
 #define rb_errinfo() ruby_errinfo
 #endif
 




More information about the ruby-oci8-commit mailing list