summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/iconv/extconf.rb4
-rw-r--r--ext/iconv/iconv.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/ext/iconv/extconf.rb b/ext/iconv/extconf.rb
index 65ea32795..62adb7a6b 100644
--- a/ext/iconv/extconf.rb
+++ b/ext/iconv/extconf.rb
@@ -21,9 +21,7 @@ if have_func("iconv", "iconv.h") or
/\bconst\b/ =~ second
end
end
- $defs.push('-DICONV_INPTR_CAST=""')
- else
- $defs.push('-DICONV_INPTR_CAST="(char **)"')
+ $defs.push('-DICONV_INPTR_CONST')
end
if conf
prefix = '$(srcdir)'
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 65dd07f7d..5715b8fbd 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -243,6 +243,11 @@ iconv_try
size_t *outlen;
#endif /* HAVE_PROTOTYPES */
{
+#ifdef ICONV_INPTR_CONST
+#define ICONV_INPTR_CAST
+#else
+#define ICONV_INPTR_CAST (char **)
+#endif
size_t ret = iconv(cd, ICONV_INPTR_CAST inptr, inlen, outptr, outlen);
if (ret == (size_t)-1) {
if (!*inlen)