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

822 Коммитов

Автор SHA1 Сообщение Дата
naruse f4dda52025 * string.c (tr_trans): free heap ptr when the str is not embeded.
patched by Eric Wong. [Bug #4956] [ruby-core:37708]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01 05:28:48 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
mrkn 30a87f3535 * string.c: Fix the ambiguous description of the behavior of
rb_str_aref_m with a range.  It returns nil when the beginning of
  the range is greater than the end of the string rather than the range.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 09:39:47 +00:00
ryan 172af01255 Clarified String#tr rdoc. (RickHull)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-01 22:29:09 +00:00
kosaki 724b1c60dc * string.c (rb_str_bytesize): rb_str_bytesize() should use LONG2NUM().
Patch by Nikolai Weibull. [Bug #4789] [ruby-core:36511]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 17:23:30 +00:00
naruse 140e1f0b15 * string.c: Improve documentation for String#start_with? and
String#end_with?. fixes #4652
  patched by Andrew Grimm <andrew.j.grimm at gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-09 09:35:27 +00:00
kosaki 8ff8d61961 * string.c (rb_to_id): remove unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-24 16:04:31 +00:00
naruse 88014987ad * string.c (rb_str_each_line): check string's length when compare
separator and string. [ruby-core:35815] fixes #4586

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-20 05:43:27 +00:00
matz 1df42597d1 cancel subversion backfire. sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:44:45 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables.  based on a patch from funny-falcon at
  https://gist.github.com/856296, but honors safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:39:39 +00:00
nobu 489e05fcc9 * string.c (tr_trans): suppress signedness/unsignedness warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 00:05:35 +00:00
naruse 1890364e90 * string.c (rb_str_slice_bang): raise error when the string is frozen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-03 09:59:51 +00:00
nobu cddcffb8f9 * string.c (str_byte_substr): return nil for negative length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-02 14:20:06 +00:00
naruse a991a12cbc * string.c (rb_str_slice_bang): move treatments which is only needed
when the result is not nil.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31004 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-02 05:09:37 +00:00
naruse 6016591e1c * string.c (rb_str_byteslice): the resulted encoding should keep
original encoding. this also fixes the encoding when the result
  shares internal string. [ruby-core:35376]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01 07:02:08 +00:00
naruse d301b4d80b Fix rdoc of String#byteslice. Feature #4447
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01 04:28:58 +00:00
naruse b8b48f9d58 * string.c (rb_str_byteslice): Add String#byteslice. [ruby-core:35376]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-01 01:35:17 +00:00
naruse 4960e66ab6 * string.c (tr_trans): when the hash for multibyte repl is empty,
tr is inverse mode, and a character doesn't much the table, the
  character should be replaced by last replacement. Bug #4449

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-28 07:46:49 +00:00
naruse 443b1517cf * string.c (rb_enc_cr_str_buf_cat): remove special treatment of
ASCII-8BIT receivers.

* string.c (str_gsub): set initial encoding of the buffer as the
  same of the receiver. [ruby-core:35141]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-15 07:08:12 +00:00
drbrain edaf78dfb6 Ensure result encoding is the same as input encoding for String#gsub. [Bug #4340].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-06 03:54:50 +00:00
kosaki e0d1e2453b * string.c (str_utf8_nth): fixed a conditon of optimized lead
byte counting. [Bug #4366][ruby-dev:43170]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-04 03:14:57 +00:00
kosaki aa36d4df21 * string.c (count_utf8_lead_bytes_with_word): wrote function
comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-03 16:54:52 +00:00
nobu f989f7c7ea * string.c (rb_str_ellipsize): new function to ellipsize a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 04:01:58 +00:00
nobu 8489ac41ca * include/ruby/ruby.h (ALLOCV): new API for exception-safe
temporary buffer.  [ruby-core:34844]
* string.c (rb_alloc_tmp_buffer, rb_free_tmp_buffer):
  implementation of the API.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-26 23:32:22 +00:00
naruse 8aa03af784 * string.c (=~): documentation fix; the return value is nil when
it doesn't match. patched by Andrei Kulakov [ruby-core:34562]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-26 01:38:05 +00:00
nobu ced2d699b0 * string.c (rb_str_resize): get rid of out-of-bound access.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 23:28:22 +00:00
nobu 7a6113d6b6 * string.c (rb_string_value_cstr): rb_str_modify can change
RSTRING_PTR.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 22:00:55 +00:00
nobu b0eaf0f621 * string.c (str_nth_len, str_utf8_nth): return the rest length together.
* string.c (rb_str_substr): get rid of measure the length always
  to improve performance for huge string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-22 23:00:12 +00:00
akr d3b337c58d fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-08 13:07:20 +00:00
akr df925d91e2 * string.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-06 15:38:14 +00:00
shyouhei f86ca53460 * string.c: fix rdoc typo.
https://github.com/shyouhei/ruby/pull/3


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 05:22:54 +00:00
naruse 2b79366f52 * string.c (rb_str_inspect): fix: extra back slash is added when
the string is dummy encoding and includes \x22 or \x5C.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 19:03:26 +00:00
nobu 417ea3a3c3 * string.c (rb_memhash): zero-filled strings should return
different values.  [ruby-core:33500]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 05:36:39 +00:00
naruse ed22b0ecee * string.c (rb_str_inspect): fix typo (not 0xFD but 0xFE).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 01:20:56 +00:00
naruse 05d7d889ea * string.c (rb_str_inspect): inspect as a dummy encoding string
when a UTF-16/32 (not BE/LE) string does not have a BOM.
  Unicode and some RFCs say that a string labeld as UTF-16/32
  doesn't have a BOM, it should be considered big endian.
  But many Windows programs generates little endian UTF-16
  strings without a BOM. So String#inspect treats a string
  labeled UTF-16/32 withaout a BOM as a dummy encoding string.
  patched by Martin Duerst. [ruby-core:33461]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-30 16:47:24 +00:00
naruse 220d07d2fc * string.c (rb_str_inspect): treat UTF-16 and UTF-32 as BE or LE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-24 02:20:11 +00:00
nobu 94e6c0c233 * string.c (rb_str_inspect): fix for ascii-compatible external
encoding and different encoding string.  [ruby-core:33283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 12:30:58 +00:00
nobu 6ade3a4291 * string.c (rb_str_inspect): append for each chars instead of bulk
copy if encoding conversion is needed.  [ruby-core:33283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 09:33:32 +00:00
naruse 3002e5e1f9 * string.c (rb_str_concat): set ENC_CODERANGE_VALID when the
receiver is 7BIT and the argument is non ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 03:01:45 +00:00
nobu 742d440cba * string.c (rb_enc_cr_str_buf_cat): concatenation of valid
encoding string and invalid encoding string should result
  invalid encoding.  [ruby-core:33027]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-03 05:13:54 +00:00
nobu 30ab36c7dc * string.c (rb_str_dump): fix expected length. [ruby-core:32935]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-28 18:04:23 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
naruse a01e628318 * numeric.c (rb_num_to_uint): added to check the range of arguments.
Mainly for negative value with NUM2UINT on 32bit environment.

* string.c (rb_str_concat): use rb_num_to_uint.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 03:56:31 +00:00
naruse 1e22306569 * string.c (rb_str_concat): use unsigned int for GB18030.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 09:25:33 +00:00
nobu f5b0cb07e2 * string.c (sym_call), vm.c (invoke_block_from_c),
vm_insnhelper.c (vm_yield_with_cfunc): pass given block.
  [ruby-core:32075]

* vm_eval.c (rb_funcall_passing_block): new function to call
  method with passing given block.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 14:45:19 +00:00
naruse c49a1d11b9 * string.c (rb_str_to_i): fix rdoc: String#to_i raises an
exception when base is invalid. [ruby-core:31685]

Fri Sep 24 15:28:35 2010  NARUSE, Yui  <naruse@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 06:52:25 +00:00
naruse 955507313b * string.c (rb_str_rindex): use rb_enc_prev_char instead of repeated str_nth.
patched by Michael Selig [ruby-core:32498]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-24 06:28:35 +00:00
nobu 757f5bcb97 * string.c (rb_str_times): mentioned about Hash argument. a patch
from Daniel Bovensiepen at [ruby-core:32386].

* sprintf.c (get_hash): ditto, and fix typo.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-14 22:27:54 +00:00