1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-10-10 02:27:41 +00:00
parent 9631e3e788
commit 91e305bcda
5 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,8 @@
Fri Oct 10 11:27:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <ngotogenome@gmail.com> Thu Oct 9 23:31:47 2014 Naohisa Goto <ngotogenome@gmail.com>
* bignum.c (absint_numwords_generic): set an array element after * bignum.c (absint_numwords_generic): set an array element after

2
NEWS
View file

@ -244,6 +244,8 @@ with all sufficient information, see the ChangeLog file.
rb_big2str0 : internal function. no replacement. rb_big2str0 : internal function. no replacement.
rb_big2ulong_pack -> rb_integer_pack rb_big2ulong_pack -> rb_integer_pack
rb_gc_set_params : internal function. no replacement. 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] * struct RBignum is hidden. [Feature #6083]
Use rb_integer_pack and rb_integer_unpack instead. Use rb_integer_pack and rb_integer_unpack instead.

View file

@ -590,11 +590,11 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
establishShell(argc, argv, &info, SlaveName); establishShell(argc, argv, &info, SlaveName);
rfptr->mode = rb_io_mode_flags("r"); rfptr->mode = rb_io_modestr_fmode("r");
rfptr->fd = info.fd; rfptr->fd = info.fd;
rfptr->pathv = rb_obj_freeze(rb_str_new_cstr(SlaveName)); 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); wfptr->fd = rb_cloexec_dup(info.fd);
if (wfptr->fd == -1) if (wfptr->fd == -1)
rb_sys_fail("dup()"); rb_sys_fail("dup()");

View file

@ -186,12 +186,12 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self)
case 2: case 2:
if (FIXNUM_P(mode)) { if (FIXNUM_P(mode)) {
int flags = FIX2INT(mode); int flags = FIX2INT(mode);
ptr->flags = rb_io_modenum_flags(flags); ptr->flags = rb_io_oflags_fmode(flags);
trunc = flags & O_TRUNC; trunc = flags & O_TRUNC;
} }
else { else {
const char *m = StringValueCStr(mode); const char *m = StringValueCStr(mode);
ptr->flags = rb_io_mode_flags(m); ptr->flags = rb_io_modestr_fmode(m);
trunc = *m == 'w'; trunc = *m == 'w';
} }
StringValue(string); StringValue(string);

View file

@ -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); ssize_t rb_io_bufwrite(VALUE io, const void *buf, size_t size);
/* compatibility for ruby 1.8 and older */ /* compatibility for ruby 1.8 and older */
#define rb_io_mode_flags(modestr) rb_io_modestr_fmode(modestr) #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_oflags_fmode(oflags) #define rb_io_modenum_flags(oflags) [<"rb_io_modenum_flags() is obsolete; use rb_io_oflags_fmode()">]
VALUE rb_io_taint_check(VALUE); VALUE rb_io_taint_check(VALUE);
NORETURN(void rb_eof_error(void)); NORETURN(void rb_eof_error(void));