ext/riconv.c in rjb-1.2.2 vs ext/riconv.c in rjb-1.2.3
- old
+ new
@@ -10,11 +10,11 @@
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * $Id: riconv.c 104 2010-03-16 12:19:18Z arton $
+ * $Id: riconv.c 117 2010-06-04 12:16:25Z arton $
*/
#include "ruby.h"
#include "extconf.h"
@@ -41,10 +41,11 @@
static const char* const CS_CP932 = "CP932";
static const char* const CS_SJIS = "SHIFT_JIS";
static const char* const CS_UTF8 = "UTF-8";
+#if RJB_RUBY_VERSION_CODE < 190
static VALUE objIconvJ2R;
static VALUE objIconvR2J;
static const char* charcode; //is this necessary?
static char Kcode = '\0';
@@ -56,11 +57,13 @@
{
if (strstr(str, table[i])) return 1;
}
return 0;
}
+#endif
+#if RJB_RUBY_VERSION_CODE < 190
static const char* get_charcode_name_by_locale(const char* const name)
{
if (find_table(name, LOCALE_UTF8_TABLE))
return NULL;
else if (find_table(name, LOCALE_EUC_TABLE))
@@ -117,12 +120,13 @@
#endif
break;
}
return result;
}
+#endif
-
+#if RJB_RUBY_VERSION_CODE < 190
static void reinit()
{
charcode = get_charcode_name();
if (charcode)
{
@@ -140,11 +144,13 @@
else
{
objIconvR2J = objIconvJ2R = Qnil;
}
}
+#endif
+#if RJB_RUBY_VERSION_CODE < 190
static void check_kcode()
{
VALUE rb_iconv_klass = rb_const_get(rb_cObject, rb_intern("Iconv"));
VALUE kcode = rb_gv_get("$KCODE");
if (RTEST(rb_iconv_klass) && TYPE(kcode) == T_STRING) {
@@ -159,9 +165,10 @@
else
{
objIconvR2J = objIconvJ2R = Qnil;
}
}
+#endif
VALUE exticonv_local_to_utf8(VALUE local_string)
{
#if RJB_RUBY_VERSION_CODE < 190
check_kcode();