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

* ext/stringio/stringio.c (strio_set_string): disallow nil.

http://www.rubyist.net/~nobu/t/20050811.html#c05


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-08-13 09:36:12 +00:00
parent 2bf3c6b631
commit 96d7c07e49
2 changed files with 13 additions and 10 deletions

View file

@ -1,7 +1,12 @@
Sat Aug 13 18:35:27 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/stringio/stringio.c (strio_set_string): disallow nil.
http://www.rubyist.net/~nobu/t/20050811.html#c05
Sat Aug 13 08:01:59 2005 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/lib/kconv.rb: Kconv.kconv is now alias of Kconv.conv
* ext/nkf/lib/kconv.rb: remove nkf dependend symbols fomr SYMBOL_TO_OPTION
* ext/nkf/lib/kconv.rb: Kconv.kconv is now alias of Kconv.conv
* ext/nkf/lib/kconv.rb: remove nkf dependend symbols fomr SYMBOL_TO_OPTION
Fri Aug 12 17:06:53 2005 Yukihiro Matsumoto <matz@ruby-lang.org>

View file

@ -96,9 +96,9 @@ get_strio(self)
#define StringIO(obj) get_strio(obj)
#define CLOSED(ptr) NIL_P((ptr)->string)
#define READABLE(ptr) (!CLOSED(ptr) && ((ptr)->flags & FMODE_READABLE))
#define WRITABLE(ptr) (!CLOSED(ptr) && ((ptr)->flags & FMODE_WRITABLE))
#define CLOSED(ptr) (!((ptr)->flags & FMODE_READWRITE))
#define READABLE(ptr) ((ptr)->flags & FMODE_READABLE)
#define WRITABLE(ptr) ((ptr)->flags & FMODE_WRITABLE)
static struct StringIO*
readable(ptr)
@ -361,10 +361,8 @@ strio_set_string(self, string)
if (!OBJ_TAINTED(self)) rb_secure(4);
ptr->flags &= ~FMODE_READWRITE;
if (!NIL_P(string)) {
StringValue(string);
ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
}
StringValue(string);
ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE;
ptr->pos = 0;
ptr->lineno = 0;
return ptr->string = string;
@ -382,7 +380,7 @@ strio_close(self)
VALUE self;
{
struct StringIO *ptr = StringIO(self);
if (CLOSED(ptr) || !(ptr->flags & FMODE_READWRITE)) {
if (CLOSED(ptr)) {
rb_raise(rb_eIOError, "closed stream");
}
ptr->flags &= ~FMODE_READWRITE;