From a774aa4e79933d6c96258c1660f1b8ee2a0cc349 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 11 Nov 2010 14:04:48 +0000 Subject: [PATCH] * ext/iconv/iconv.c (warn_deprecated): show caller position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ ext/iconv/iconv.c | 26 +++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c0c07dab84..7305aa091c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Nov 11 23:04:44 2010 Nobuyoshi Nakada + + * ext/iconv/iconv.c (warn_deprecated): show caller position. + Thu Nov 11 23:03:12 2010 Nobuyoshi Nakada * io.c (argf_close): untie tied io before closing. diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 2aab1e92f4..83a4b5e299 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -1179,12 +1179,36 @@ iconv_failure_inspect(VALUE self) * * returns an error without setting errno properly */ +static void +warn_deprecated(void) +{ + static const char message[] = + ": iconv will be deprecated in the future, use String#encode instead.\n"; + VALUE msg = Qnil, caller = rb_make_backtrace(); + long i; + + for (i = 1; i < RARRAY_LEN(caller); ++i) { + VALUE s = RARRAY_PTR(caller)[i]; + if (strncmp(RSTRING_PTR(s), "