From 91e305bcda2e669cd4196b8e0103fb441fa4cc6e Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 10 Oct 2014 02:27:41 +0000 Subject: ruby/io.h: deprecate old macros * include/ruby/io.h (rb_io_mode_flags, rb_io_modenum_flags): deprecate old macros for compatibility for ruby 1.8 and older. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ NEWS | 2 ++ ext/pty/pty.c | 4 ++-- ext/stringio/stringio.c | 4 ++-- include/ruby/io.h | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0945986733..ffac7d8492 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 10 11:27:49 2014 Nobuyoshi Nakada + + * include/ruby/io.h (rb_io_mode_flags, rb_io_modenum_flags): + deprecate old macros for compatibility for ruby 1.8 and older. + Thu Oct 9 23:31:47 2014 Naohisa Goto * bignum.c (absint_numwords_generic): set an array element after diff --git a/NEWS b/NEWS index b52495a176..82ab9b3cde 100644 --- a/NEWS +++ b/NEWS @@ -244,6 +244,8 @@ with all sufficient information, see the ChangeLog file. rb_big2str0 : internal function. no replacement. rb_big2ulong_pack -> rb_integer_pack rb_gc_set_params : internal function. no replacement. + rb_io_mode_flags -> rb_io_modestr_fmode + rb_io_modenum_flags -> rb_io_oflags_fmode * struct RBignum is hidden. [Feature #6083] Use rb_integer_pack and rb_integer_unpack instead. diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 3ea5d5c8ce..18983f40b1 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -590,11 +590,11 @@ pty_getpty(int argc, VALUE *argv, VALUE self) establishShell(argc, argv, &info, SlaveName); - rfptr->mode = rb_io_mode_flags("r"); + rfptr->mode = rb_io_modestr_fmode("r"); rfptr->fd = info.fd; rfptr->pathv = rb_obj_freeze(rb_str_new_cstr(SlaveName)); - wfptr->mode = rb_io_mode_flags("w") | FMODE_SYNC; + wfptr->mode = rb_io_modestr_fmode("w") | FMODE_SYNC; wfptr->fd = rb_cloexec_dup(info.fd); if (wfptr->fd == -1) rb_sys_fail("dup()"); diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index bf39a874a3..ae3843041e 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -186,12 +186,12 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self) case 2: if (FIXNUM_P(mode)) { int flags = FIX2INT(mode); - ptr->flags = rb_io_modenum_flags(flags); + ptr->flags = rb_io_oflags_fmode(flags); trunc = flags & O_TRUNC; } else { const char *m = StringValueCStr(mode); - ptr->flags = rb_io_mode_flags(m); + ptr->flags = rb_io_modestr_fmode(m); trunc = *m == 'w'; } StringValue(string); diff --git a/include/ruby/io.h b/include/ruby/io.h index cc3f5e60b1..f71176043f 100644 --- a/include/ruby/io.h +++ b/include/ruby/io.h @@ -188,8 +188,8 @@ int rb_io_extract_encoding_option(VALUE opt, rb_encoding **enc_p, rb_encoding ** ssize_t rb_io_bufwrite(VALUE io, const void *buf, size_t size); /* compatibility for ruby 1.8 and older */ -#define rb_io_mode_flags(modestr) rb_io_modestr_fmode(modestr) -#define rb_io_modenum_flags(oflags) rb_io_oflags_fmode(oflags) +#define rb_io_mode_flags(modestr) [<"rb_io_mode_flags() is obsolete; use rb_io_modestr_fmode()">] +#define rb_io_modenum_flags(oflags) [<"rb_io_modenum_flags() is obsolete; use rb_io_oflags_fmode()">] VALUE rb_io_taint_check(VALUE); NORETURN(void rb_eof_error(void)); -- cgit v1.2.3