ruby-changes:7206
From: akr <ko1@a...>
Date: Wed, 20 Aug 2008 20:17:14 +0900 (JST)
Subject: [ruby-changes:7206] Ruby:r18725 (trunk): * io.c (rb_scan_open_args): extracted from rb_open_file.
akr 2008-08-20 20:16:59 +0900 (Wed, 20 Aug 2008) New Revision: 18725 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18725 Log: * io.c (rb_scan_open_args): extracted from rb_open_file. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 18724) +++ ChangeLog (revision 18725) @@ -1,3 +1,7 @@ +Wed Aug 20 20:16:17 2008 Tanaka Akira <akr@f...> + + * io.c (rb_scan_open_args): extracted from rb_open_file. + Wed Aug 20 19:22:32 2008 Tanaka Akira <akr@f...> * io.c (convconfig_t): new type. Index: io.c =================================================================== --- io.c (revision 18724) +++ io.c (revision 18725) @@ -4523,13 +4523,14 @@ } } -static VALUE -rb_open_file(int argc, VALUE *argv, VALUE io) +static void +rb_scan_open_args(int argc, VALUE *argv, + VALUE *fname_p, int *modenum_p, int *flags_p, + convconfig_t *convconfig_p, unsigned int *fmode_p) { VALUE opt=Qnil, fname, vmode, perm; int modenum, flags; unsigned int fmode; - convconfig_t convconfig = { NULL, NULL }; if (0 < argc) { opt = rb_check_convert_type(argv[argc-1], T_HASH, "Hash", "to_hash"); @@ -4560,10 +4561,25 @@ #endif FilePathValue(fname); - rb_io_extract_modeenc(vmode, opt, &modenum, &flags, &convconfig); + rb_io_extract_modeenc(vmode, opt, &modenum, &flags, convconfig_p); fmode = NIL_P(perm) ? 0666 : NUM2UINT(perm); + *fname_p = fname; + *modenum_p = modenum; + *flags_p = flags; + *fmode_p = fmode; +} + +static VALUE +rb_open_file(int argc, VALUE *argv, VALUE io) +{ + VALUE fname; + int modenum, flags; + convconfig_t convconfig; + unsigned int fmode; + + rb_scan_open_args(argc, argv, &fname, &modenum, &flags, &convconfig, &fmode); rb_file_open_generic(io, RSTRING_PTR(fname), modenum, flags, &convconfig, fmode); return io; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/