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

298 Коммитов

Автор SHA1 Сообщение Дата
matz 2126364501 * string.c (rb_str_ord): typo fixed. reported from Kornelius
Kalnbach <murphy@rubychan.de>.  [ruby-core:09621]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-21 16:47:01 +00:00
matz 2b38c2e0fb * string.c (rb_str_slice_bang): rdoc description bug fixed.
[ruby-core:09754]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-21 16:41:17 +00:00
matz f70c171f8c * string.c (rb_str_aset): index double decode problem.
[ruby-core:09695]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-11 00:45:32 +00:00
matz 0ee03fefad * string.c (Init_String): remove duplicated definition of
Symbol#to_s.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-06 13:24:57 +00:00
matz 6d32246b31 * parse.y (arg_dup_check): vid may be nameless internal id.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-06 06:37:40 +00:00
matz 030204ccf3 * string.c: class Symbol is no longer subclass of String. also
covers [ruby-core:09366]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-02 01:27:58 +00:00
matz 11e562f34a * string.c (hash): use Bob Jenkins' hash algorithm.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-01 14:23:42 +00:00
matz be21791e57 * string.c (rb_str_upcase, rb_str_downcase, rb_str_downcase,
rb_str_upcase_bang, rb_str_downcase_bang, rb_str_swapcase_bang):
  add RDoc description that case conversion to be effective only
  in ASCII region.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-22 08:06:16 +00:00
nobu 1366131642 * string.c (rb_str_substr): should be infected with only original
string, but not the shared string.  fixed: [ruby-core:09152]

* strnig.c (rb_str_new4): keep shared string untainted when orignal
  string is tainted.  fixed: [ruby-dev:29672]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-22 07:48:53 +00:00
matz f87431ce95 * string.c (rb_str_each_line): String#lines now works when a block
is given.  in other words, lines become an alias to each_line.
  [ruby-core:09218]

* string.c (rb_str_each_byte): ditto for bytes in place of lines.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-18 04:30:40 +00:00
matz 24691fa633 * string.c (rb_str_lines): now takes optional argument for the
line separator.

* io.c (rb_io_lines, rb_io_bytes): new methods.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-16 23:07:07 +00:00
matz 7df8b0501a * string.c (rb_str_partition): RDoc update. a patch from
Mauricio Fernandez <mfp at acm.org>.  [ruby-core:09160]

* hash.c (rb_hash_compare_by_id): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-12 16:07:21 +00:00
matz d2133ab996 * string.c (rb_str_scan): small documentation fix.
[ruby-core:09007]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-07 15:55:17 +00:00
matz 4392e94d96 * string.c (rb_str_lines): returns an Enumerator instead of an
array of lines.

* string.c (rb_str_bytes): a new method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-02 16:39:21 +00:00
matz 62ad417517 * string.c (rb_str_startwith): rename startwith? to start_with?,
endwith? to endwith?, respectively.  [ruby-talk:216685]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-27 12:45:29 +00:00
matz 1113d54ede * array.c (rb_ary_shift): shift/unshift performance boost patch,
based on the patch from Eric Mahurin <eric_mahurin at yahoo.com>.
  [ruby-core:05861]

* array.c (rb_ary_unshift_m): ditto.

* array.c (ary_make_shared): ditto.

* array.c (RESIZE_CAPA): ditto.

* array.c (rb_ary_free): new function to free memory.  code moved
  from gc.c.

* string.c (rb_str_free): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-26 22:46:16 +00:00
matz a2fc608087 * string.c (rb_str_partition): no need to call rb_call_super(),
since String is no longer includes Enumerable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-22 09:08:58 +00:00
matz 5b950717b7 * string.c (str_new3): embed shorter strings more eagerly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 22:50:32 +00:00
matz f5ec2b0d75 * string.c (rb_str_startwith): a new method to check if a string
starts with given prefix.

* string.c (rb_str_endwith): the opposite of String#startwith?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 08:47:03 +00:00
matz 4e37427ee5 * string.c (Init_String): Strings are no longer Enumerable. use
each_lines or lines method explicitly.

* string.c (Init_String): remove each method. use each_lines.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 05:57:20 +00:00
matz 77fef79f10 * string.c (rb_str_partition): RDoc typo fixed. [ruby-core:08898]
* string.c (rb_str_rpartition): fixed separation seek bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 01:10:25 +00:00
matz e79002a022 * string.c (rb_str_lines): new method to split a string into lines.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-21 00:43:16 +00:00
matz 71afefd5d1 * string.c (rb_str_partition): a new method to separate the string
by a separator.  taken from Python 2.5.

* string.c (rb_str_rpartition): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-20 16:41:56 +00:00
matz 803591e900 * string.c (sym_eql): fail early to gain performance.
* string.c (sym_hash): cache hash value in aux.shared if possible.

* gc.c (rb_obj_id): no need to treat symbols specially.

* lib/fileutils.rb (FileUtils::FileUtils): singleton_methods() no
  longer return an array of strings, but of symbols.

* lib/delegate.rb (DelegateClass): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-20 04:18:25 +00:00
matz 2a23c281a1 * string.c (rb_str_intern): allow zero length symbols.
[ruby-core:08861]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-14 07:36:53 +00:00
matz 23d2c8b624 * string.c (rb_str_intern): raise SecurityError only when $SAFE
level is greater than zero.  [ruby-core:08862]

* parse.y (rb_interned_p): new function to check if a string is
  already interned.

* string.c (str_to_id): use rb_str_intern().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-14 07:27:14 +00:00
matz e6340674d1 * string.c (rb_str_intern): allow symbols to contains nul.
* string.c (sym_inspect): symbol may contain nul.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-13 08:19:54 +00:00
matz 96a8a44317 * string.c (rb_str_intern): prohibit interning tainted string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-13 08:15:21 +00:00
matz a36197bd58 * string.c (sym_equal): "sym == str" should compare them as
strings.  [ruby-dev:29554]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-10 22:41:52 +00:00
matz 0f785c3840 * file.c (rb_f_test): test(0) should not have any special
meaning.  [ruby-dev:29425]

* file.c (rb_f_test): properer error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-09 16:19:33 +00:00
matz 82f7f29c59 * string.c (str_alloc): should allocate a String object, even when
asked to allocate a Symbol object.  [ruby-dev:29529]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-08 07:55:51 +00:00
matz d314a7dd85 * string.c (sym_equal): override. check equivalence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-06 16:59:10 +00:00
matz 10a0dea1f5 * string.c (Init_String): undef Symbol#new.
* struct.c (rb_struct_s_def): wrong symbol detection.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 15:20:24 +00:00
matz d064c0bf13 * string.c (str_to_id): a bug caused by premature optimization.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 15:13:26 +00:00
matz ccf5372b25 * object.c (Init_Object): move symbol related code to string.c
* string.c (Init_String): Symbol as subclass of String.

* parse.y (rb_intern2): handle symbol as strings.

* string.c (str_new): substring of symbols are mere strings, not
  symbols.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 15:05:27 +00:00
matz 2156870525 * ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members.
  (RARRAY_PTR): ditto.

* array.c: use RARRAY_LEN and RARRAY_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 14:42:08 +00:00
matz a20d60c819 string.c (rb_str_resize): typo fixed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-01 13:11:16 +00:00
matz 9ba4002960 * string.c (rb_str_resize): should copy embedded string to
malloc'ed buffer.  a patch from <nobu at ruby-lang.org> in
  [ruby-dev:29369].  fixed: [ruby-dev:29368]

* string.c (rb_str_ord): use %ld specifier since STRING_LEN() is a
  long.  [ruby-dev:29369]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-01 13:07:05 +00:00
matz 54af80844f * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:47:44 +00:00
nobu 59b1cef2f1 * numeric.c (flo_hash): improve collision.
* string.c (rb_memhash): new generic function to calculate hash value
  for memory chunk.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-30 03:02:35 +00:00
drbrain 8b827f1a7d Describe String#split grouping behavior. Patch by Jan Svitok [ruby-core:08603].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-13 05:35:35 +00:00
matz 69be57eb57 * string.c (rb_str_scan): add string modification check.
[ruby-core:7216]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-26 07:43:16 +00:00
usa 6f535f34c5 * string.c (rb_str_dump): need to extend len for \b.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-11 08:34:28 +00:00
nobu 0fbcc455bd * string.c (rb_str_ord): extract lower byte. fixed: [ruby-dev:28980]
* lib/jcode.rb (String#succ!): fix for 1.9.  fixed: [ruby-dev:28979]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-07 08:49:34 +00:00
matz 1564ed2f0a * bignum.c: ruby 1.9 HEAD 64 bit warnings clean up from
<ville.mattila at stonesoft.com>.   [ruby-core:08120]

* ChangeLog: remove some direct reference to mail addresses
  to prevent spams.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-03 20:07:10 +00:00
matz d4e2d4ea96 * string.c (rb_str_inspect): encode \b (\010) for escape.
[ruby-dev:28927]

* string.c (rb_str_dump): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-02 16:20:16 +00:00
matz 471e41ec70 * string.c: RDoc update for =~ method. a patch from Alex Young
<alex at blackkettle.org>.  [ruby-core:08068]

* io.c (pipe_open): backout unnecessary fix on 2006-06-26.
  [ruby-dev:28865]

* eval.c (rb_yield_0): exact argument number check now done only
  for lambda Proc.

* eval.c (rb_yield_0): add check for number of arguments, if
  there's one lambda block parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-27 14:14:25 +00:00
matz 66de9ef349 * string.c (rb_str_aref): "abc"[3] should not return an empty
string but nil.  [ruby-dev:28786]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-22 01:39:44 +00:00
matz 1b7465e893 * eval.c, file.c, etc.: code-cleanup patch from Stefan Huehner
<stefan at huehner.org>.  [ruby-core:08029]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-20 18:02:17 +00:00
matz d1a5aa5685 * ext/bigdecimal/lib/bigdecimal/newton.rb (Newton::nlsolve): typo
fixed: raize -> raise.  [ruby-talk:196608]

* string.c (rb_str_ord): new method.

* parse.y (rbracket): allow optional newline before closing
  brackets.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-10 16:09:12 +00:00