Граф коммитов

135 Коммитов

Автор SHA1 Сообщение Дата
nobu 7a5b56677a stringio.c: warn block for new
* ext/stringio/stringio.c (strio_s_new): warn if a block is given,
  as well as IO.new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27 06:47:56 +00:00
normal dc59c76898 stringio: binmode sets encoding to ASCII-8BIT
This should match the behavior of IO#binmode as far
as treating content as ASCII-8BIT (binary).

* ext/stringio/stringio.c (strio_binmode): implement to set encoding
* test/stringio/test_stringio.rb (test_binmode): new test
  [ruby-core:72699] [Bug #11945]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-04 20:45:14 +00:00
nobu f4166e2dd7 prefer rb_syserr_fail
* file.c, io.c, util.c: prefer rb_syserr_fail with saved errno
  over setting errno then call rb_sys_fail, not to be clobbered
  potentially and to reduce thread local errno accesses.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23 08:57:48 +00:00
nobu 3e1c01ae46 stringio.c: separate encoding from buffer
* ext/stringio/stringio.c (strio_set_encoding): add StringIO's own
  encoding and separate it from the buffer string to override the
  encoding of string when reading.  [ruby-core:72189] [Bug #11827]
  note that setting the encoding of its buffer string may cause
  unpredictable behavior.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18 07:54:33 +00:00
nobu 21973c01ab stringio.c: strio_unget_bytes
* ext/stringio/stringio.c (strio_unget_bytes): extract from
  strio_ungetbyte to share with strio_ungetc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18 06:40:00 +00:00
nobu b7d1536991 stringio.c: padding in ungetbyte
* ext/stringio/stringio.c (strio_ungetbyte): pad with \000 when
  the current position is after the end.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-18 03:09:16 +00:00
nobu 0d89c6db7e stringio.c: unused variable
* ext/stringio/stringio.c (strio_memsize): remove a variable which
  is no longer used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 02:43:55 +00:00
ko1 dff42b0ea0 * ext/**/*.c (*_memsize): same as r52986 for extensions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 01:01:17 +00:00
nobu 898fd2ed2a use rb_check_arity [ci skip]
* ext: use rb_check_arity and rb_error_arity to raise
  ArgumentError.  [Feature #9025]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-25 00:43:06 +00:00
nobu 8c0b261d48 stringio.c: Fix an example doc [ci skip]
* ext/stringio/stringio.c (Init_stringio): [DOC] Fix an example,
  StringIO#puts should be set "\n" at last.  [Fix GH-965]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-11 12:16:37 +00:00
nobu f7946774dd stringio.c: remove unnecessary check
* ext/stringio/stringio.c (writable): remove unnecessary check for
  deprecated safe level 4.  [Fix GH-963]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10 01:46:04 +00:00
normal df4e282eeb delay `exception: false' checks for minor speedup
Delay hash lookups until we are about to hit an exception.  This
gives a minor speedup ratio of 2-3% in the new bm_io_nonblock_noex
benchmark as well as reducing code.

* benchmark/bm_io_nonblock_noex.rb: new benchmark
* ext/openssl/ossl_ssl.c (no_exception_p): new function
  (ossl_start_ssl): adjust for no_exception_p
  (ossl_ssl_connect): adjust ossl_start_ssl call
  (ossl_ssl_connect_nonblock): ditto
  (ossl_ssl_accept): ditto
  (ossl_ssl_accept_nonblock): ditto
  (ossl_ssl_read_internal): adjust for no_exception_p
  (ossl_ssl_write_internal): ditto
  (ossl_ssl_write): adjust ossl_write_internal call
  (ossl_ssl_write_nonblock): ditto
* ext/stringio/stringio.c (strio_read_nonblock):
  delay exception check
* io.c (no_exception_p): new function
  (io_getpartial): call no_exception_p
  (io_readpartial): adjust for io_getpartial
  (get_kwargs_exception): remove
  (io_read_nonblock): adjust for io_getpartial,
  check no_exception_p on EOF
  (io_write_nonblock): call no_exception_p
  (rb_io_write_nonblock): do not check `exception: false'
  (argf_getpartial): adjust for io_getpartial
  [ruby-core:69778] [Feature #11318]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02 22:22:14 +00:00
nobu f75fe0bcc7 stringio.c: don't raise after close
* ext/stringio/stringio.c (strio_close): don't raise on dobule
  close for consistent to IO#close.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-13 06:04:39 +00:00
nobu 2e02f2dfd2 stringio.c: don't raise after close
* ext/stringio/stringio.c (strio_close): don't raise on dobule
  close for consistent to IO#close.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-09 07:34:39 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
nobu 91e305bcda 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
2014-10-10 02:27:41 +00:00
nobu 28b9f11d5a protoize no-arguments functions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30 05:25:32 +00:00
nobu 2a8989d71c stringio.c: ASCII-8BIT StringIO rejects no encodings
* ext/stringio/stringio.c (strio_write): ASCII-8BIT StringIO
  should be writable any encoding strings, without conversion.
  [ruby-core:65240] [Bug #10285]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-26 03:52:37 +00:00
nobu 2c14872b9f stringio.c: use rb_str_append other than ASCII-8BIT
* ext/stringio/stringio.c (strio_write): use rb_str_append to
  reuse coderange bits other than ASCII-8BIT, and keep
  taintedness.  [ruby-dev:48118] [Bug #9769]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-23 02:03:43 +00:00
nobu 3ec18aa23a stringio.c: move GC guard
* ext/stringio/stringio.c (strio_write): move GC guard after the
  last using position.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-23 02:03:35 +00:00
naruse 506c6f52b9 Revert r45670 "stringio.c: use rb_str_append"
It breaks test-all.
http://u64b.rubyci.org/~chkbuild/ruby-trunk/log/20140422T143301Z.diff.html.gz

rb_str_conv_enc() return original string for example when
from ASCII-8BIT to UTF-8 with non ASCII strings

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-22 18:44:48 +00:00
nobu a197581765 stringio.c: use rb_str_append
* ext/stringio/stringio.c (strio_write): use rb_str_append to
  reuse coderange bits and keep taintedness.
  [ruby-dev:48118] [Bug #9769]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-22 14:14:30 +00:00
nobu 90e393b368 stringio.c: non-ascii encoding
* ext/stringio/stringio.c (strio_putc): fix for non-ascii
  encoding, like as IO#putc.  [ruby-dev:48114] [Bug #9765]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-21 05:11:50 +00:00
hsbt c6c6a74fed * ext/stringio/stringio.c: [DOC] add docs and example by @schneems [ci skip] [fix GH-527]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-06 03:08:38 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
ko1 69c8ab256d * ext/stringio/stringio.c (strio_read_nonblock): declare local
variables at the first of function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 04:04:33 +00:00
tenderlove 988ca60565 * io.c (io_read_nonblock): support non-blocking reads without raising
exceptions. As in: `io.read_nonblock(size, exception: false)`
  [ruby-core:38666] [Feature #5138]
* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): ditto
* ext/stringio/stringio.c (strio_sysread): ditto
* io.c (rb_io_write_nonblock): support non-blocking writes without
  raising an exception.
* ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): ditto
* test/openssl/test_pair.rb (class OpenSSL): tests
* test/ruby/test_io.rb (class TestIO): ditto
* test/socket/test_nonblock.rb (class TestSocketNonblock): ditto
* test/stringio/test_stringio.rb (class TestStringIO): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26 22:41:44 +00:00
headius 7974fe6a78 * ext/stringio/stringio.c (strio_substr): Trivial fix for invalid
pointer when len = 0 and pos outside of string. Bug #8728.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-03 21:53:54 +00:00
nobu 8776802385 stringio.c: keep coderange
* ext/stringio/stringio.c (strio_write): keep coderange of
  ptr->string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-01 06:04:23 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
nobu db41a18845 rename generic io modules
* ext/io/console/console.c, ext/stringio/stringio.c: rename internally
  used modules as generic_readable and generic_writable.  [Fix GH-315]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-24 06:54:17 +00:00
zzak e87c6b192d * ext/stringio/stringio.c: Correct position of method rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 22:49:29 +00:00
zzak 3a7a773aeb * ext/socket/option.c: Document synonymous methods, by windwiny [GH-277]
* ext/stringio/stringio.c: ditto
* ext/io/wait/wait.c: ditto
* ext/gdbm/gdbm.c: ditto
* ext/dl/cfunc.c: ditto
* ext/zlib/zlib.c: ditto
* ext/win32ole/win32ole.c: ditto
* ext/dbm/dbm.c: ditto
* ext/json/generator/generator.c: ditto
* ext/date/date_core.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-16 03:25:50 +00:00
glass 89182621d9 * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
when limit is nil.
  [Bug #7232] [ruby-core:48531]

* test/stringio/test_stringio.rb: a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-27 12:21:17 +00:00
glass cd453f16b4 * ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeError
if the string is frozen.
  [Bug #7231] [ruby-core:48530]

* ext/stringio/stringio.c (strio_ungetbyte): ditto.

* test/stringio/test_stringio.rb: a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-27 11:43:02 +00:00
knu c47c095b97 Deprecate #{lines,bytes,chars,codepoints} of IO-likes.
* io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints):
  Deprecate IO#{lines,bytes,chars,codepoints} and those of ARGF.
  [Feature #6670]

* ext/stringio/stringio.c (strio_lines, strio_bytes, strio_chars)
  (strio_codepoints): Deprecate
  StringIO#{lines,bytes,chars,codepoints}. [Feature #6670]

* ext/zlib/zlib.c (rb_gzreader_lines, rb_gzreader_bytes):
  Deprecate Zlib::GzipReader#{lines,bytes}. [Feature #6670]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 17:22:04 +00:00
nobu 56f9574de8 stringio.c: close separatedly
* ext/stringio/stringio.c (strio_close): close separatedly per each
  instances, as well as IO.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-29 09:23:02 +00:00
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00
drbrain ab0eb272f9 * io.c (io_readpartial): Document the output buffer parameter is
overwritten with the read contents even when non-empty.
  Patch by yu nobuoka.  [ruby-trunk - Bug #6285]
* io.c (io_read_nonblock):  ditto.
* io.c (io_read):  ditto.
* io.c (rb_io_sysread):  ditto.
* io.c (argf_read):  ditto.
* io.c (argf_readpartial):  ditto.
* ext/stringio/stringio.c (strio_read):  ditto.
* test/ruby/test_argf.rb (class TestArgf):  Add test for existing
  behavior of read outbuf.
* test/ruby/test_io.rb (class TestIO):  ditto.
* test/stringio/test_stringio.rb (class TestStringIO):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18 23:48:27 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
nobu 8335ce7065 * ext/io/console/console.c (io_getch): default delegating method
for StringIO.  https://github.com/nobu/io-console/issues/4
* ext/stringio/stringio.c: moved some methods to hidden modules.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-25 18:24:09 +00:00
nobu 5c68e601e8 * ext/stringio/stringio.c (strio_truncate): fix typo. patched by
Nick Howard <ndh AT baroquebobcat.com>.
  https://github.com/ruby/ruby/pull/65

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-12 06:41:05 +00:00
nobu dcb7cc1a8b * ext/stringio/stringio.c (strio_read): return new string if nil
is explicitly given as a buffer ([Bug #5207]), otherwise set the
  encoding.  also removed dead code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-20 01:43:26 +00:00
nobu b4dc41d42e fix style.
* ext/stringio/stringio.c (strio_each, strio_readlines): fix style.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-14 12:16:09 +00:00
sorah 6eb7740472 * ext/stringio/stringio.c (strio_each, strio_readlines):
Use `NUM2LONG` instead of `FIX2INT`. Fixes [ruby-dev:43395].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-09 15:10:03 +00:00
sorah 4e817b39b4 * ext/stringio/stringio.c (strio_each):
Fix exception message and don't raise immediately if block is not given.
  Fixes [ruby-dev:43394].

* test/stringio/test_stringio.rb (test_each_line_limit_0):
  Fix test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-09 14:28:06 +00:00
sorah 0a69f2e39d * ext/stringio/stringio.c (strio_each, strio_readlines):
limit must not be zero. Fixes [ruby-dev:43392].

* test/stringio/test_stringio.rb: Add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-09 13:01:23 +00:00
naruse 653b4248a3 * ext/stringio/stringio.c (strio_getline): check whether str is
a string when str and lim are given.
  https://twitter.com/watson1978/status/56225052152168449

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-08 07:50:49 +00:00
akr 80fb9c7b4e * ext/stringio/stringio.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-29 15:25:25 +00:00
nobu d8d9bac5c8 * ext/stringio/stringio.c (get_strio, strio_set_string)
(strio_reopen): check if frozen.  [ruby-core:33648]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 20:14:43 +00:00