[ruby-cvs:62739] ngoto:r55575 (trunk): * string.c (rb_str_change_terminator_length): New function to change

ngoto at ruby-lang.org ngoto at ruby-lang.org
Tue Jul 5 19:45:24 JST 2016

ngoto	2016-07-05 19:45:23 +0900 (Tue, 05 Jul 2016)

  New Revision: 55575


    * string.c (rb_str_change_terminator_length): New function to change
      termlen and resize heap for the terminator. This is split from
      rb_str_fill_terminator (str_fill_term) because filling terminator
      and changing terminator length are different things. [Bug #12536]
    * internal.h: declaration for rb_str_change_terminator_length.
    * string.c (str_fill_term): Simplify only to zero-fill the terminator.
      For non-shared strings, it assumes that (capa + termlen) bytes of
      heap is allocated. This partially reverts r55557.
    * encoding.c (rb_enc_associate_index): rb_str_change_terminator_length
      is used, and it should be called whenever the termlen is changed.
    * string.c (str_capacity): New static function to return capacity
      of a string with the given termlen, because the termlen may
      sometimes be different from TERM_LEN(str) especially during
      changing termlen or filling terminator with specific termlen.
    * string.c (rb_str_capacity): Use str_capacity.

  Modified files:

More information about the ruby-cvs mailing list