aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/iconv/extconf.rb1
-rw-r--r--ext/iconv/iconv.c18
3 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index acac149a43..8c414eff8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Dec 6 01:00:38 2007 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/iconv/iconv.c (iconv_s_list): support NetBSD/Citrus iconv.
+
Wed Dec 5 16:18:50 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* proc.c (rb_proc_s_new): call initialize. [ruby-core:13824]
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb
index 6e23396843..9632bf4db9 100644
--- a/ext/iconv/extconf.rb
+++ b/ext/iconv/extconf.rb
@@ -24,6 +24,7 @@ if have_func("iconv", "iconv.h") or
$defs.push('-DICONV_INPTR_CONST')
end
have_func("iconvlist", "iconv.h")
+ have_func("__iconv_free_list", "iconv.h")
if conf
prefix = '$(srcdir)'
prefix = $nmake ? "{#{prefix}}" : "#{prefix}/"
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 844b792208..fbbca7e3b9 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -741,6 +741,24 @@ iconv_s_list(void)
state = *(int *)args;
if (state) rb_jump_tag(state);
if (args[1]) return args[1];
+#elif defined(HAVE___ICONV_FREE_LIST)
+ char **list;
+ size_t sz, i;
+ VALUE ary;
+
+ if (__iconv_get_list(&list, &sz)) return Qnil;
+
+ ary = rb_ary_new2(sz);
+ for (i = 0; i < sz; i++) {
+ rb_ary_push(ary, rb_str_new2(list[i]));
+ }
+ __iconv_free_list(list, sz);
+
+ if (!rb_block_given_p())
+ return ary;
+ for (i = 0; i < RARRAY_LEN(ary); i++) {
+ rb_yield(RARRAY_PTR(ary)[i]);
+ }
#else
rb_notimplement();
#endif