aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
Commit message (Collapse)AuthorAgeFilesLines
* Move variable closer to usageAlan Wu2020-10-301-1/+1
|
* Don't redefine #rb_intern over and over againStefan Stüben2020-10-211-9/+6
|
* Enhanced RDoc for String#insert (#3643)Burdette Lamar2020-10-081-13/+13
| | | | * Enhanced RDoc for String#insert
* Enhanced RDoc for String#[] (#3607)Burdette Lamar2020-09-301-65/+65
| | | | * Enhanced RDoc for String#[]
* Enhanced RDoc for String#upto (#3603)Burdette Lamar2020-09-291-29/+23
| | | | * Enhanced RDoc for String#upto
* Enhanced RDoc for String#succ! (#3596)Burdette Lamar2020-09-281-3/+4
| | | * Enhanced RDoc for String#succ!
* Enhanced RDoc for String#succ (#3590)Burdette Lamar2020-09-251-21/+49
| | | | * Enhanced RDoc for String#succ
* Enhanced RDoc for String#match? (#3576)Burdette Lamar2020-09-241-13/+25
| | | * Enhanced RDoc for String#match?
* Enhanced RDoc for String (#3574)Burdette Lamar2020-09-241-42/+41
| | | | | | | Methods: =~ match
* Enhanced RDoc for String (#3569)Burdette Lamar2020-09-241-81/+119
| | | | | | | | | | | | | | Makes some methods doc compliant with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc. Also, other minor revisions to make more consistent. Methods: == === eql? <=> casecmp casecmp? index rindex
* Fix call-seq [ci skip]Kazuhiro NISHIYAMA2020-09-231-1/+1
| | | | | | | | | `encoding` can be not only an encoding name, but also an Encoding object. ``` s = String.new('foo', encoding: Encoding::US_ASCII) s.encoding # => #<Encoding:US-ASCII> ```
* Enhanced RDoc for String (#3565)Burdette Lamar2020-09-221-44/+42
| | | | | | | | | | | | | Makes some methods doc compliant with https://github.com/ruby/ruby/blob/master/doc/method_documentation.rdoc. Also, other minor revisions to make more consistent. Methods: try_convert +string -string concat << prepend hash
* Comply with guide for method doc: string.c (#3528)Burdette Lamar2020-09-211-70/+42
| | | | | | | | | | | | Methods: ::new #length #bytesize #empty? #+ #* #%
* sync fstring_table for deletionKoichi Sasada2020-09-181-2/+7
| | | | | Ractors can access this table simultaneously so we need to sync accesses.
* sync fstring poolKoichi Sasada2020-09-151-6/+12
| | | | fstring pool should be sync with other Ractors.
* Let String#slice! return nil (#3533)Soutaro Matsumoto2020-09-111-1/+4
| | | Returns `nil` instead of an empty string when non-integer number is given (to make it 2.7 compatible).
* Added Symbol#nameNobuyoshi Nakada2020-09-041-0/+1
| | | https://bugs.ruby-lang.org/issues/16150#change-87446
* Partial compliance with doc/method_documentation.rdoc in string.c (#3436)Burdette Lamar2020-08-201-23/+4
| | | Removes references to *-convertible thingies.
* register_fstring: avoid duping the passed string when possibleJean Boussier2020-08-191-1/+2
| | | | | | | | If the passed string is frozen, bare and not shared, then there is no need to duplicate it. Ref: 4ab69ebbd7cef8539f687e1f948845d076461dc6 Ref: https://bugs.ruby-lang.org/issues/11386
* [DOC] fixed a missing markupNobuyoshi Nakada2020-08-151-1/+1
|
* rb_str_{index,rindex}_m: Handle /\K/ in patternKasumi Hanazuki2020-08-131-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | When the pattern Regexp given to String#index and String#rindex contain a /\K/ (lookbehind) operator, these methods return the position where the beginning of the lookbehind pattern matches, while they are expected to return the position where the \K matches. ``` # without patch "abcdbce".index(/b\Kc/) # => 1 "abcdbce".rindex(/b\Kc/) # => 4 ``` This patch fixes this problem by using BEG(0) instead of the return value of rb_reg_search. ``` # with patch "abcdbce".index(/b\Kc/) # => 2 "abcdbce".rindex(/b\Kc/) # => 5 ``` Fixes [Bug #17118]
* rb_str_{partition,rpartition}_m: Handle /\K/ in patternKasumi Hanazuki2020-08-131-23/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the pattern given to String#partition and String#rpartition contain a /\K/ (lookbehind) operator, the methods return strings sliced at incorrect positions. ``` # without patch "abcdbce".partition(/b\Kc/) # => ["a", "c", "cdbce"] "abcdbce".rpartition(/b\Kc/) # => ["abcd", "c", "ce"] ``` This patch fixes the problem by using BEG(0) instead of the return value of rb_reg_search. ``` # with patch "abcdbce".partition(/b\Kc/) # => ["ab", "c", "dbce"] "abcdbce".rpartition(/b\Kc/) # => ["abcdb", "c", "e"] ``` As a side-effect this patch makes String#partition 2x faster when the pattern is a costly Regexp by performing Regexp search only once, which was unexpectedly done twice in the original implementation. Fixes [Bug #17119]
* string.c(rb_str_split_m): Handle /\K/ correctlyKasumi Hanazuki2020-08-121-1/+2
| | | | | | | Use BEG(0) instead of the result of rb_reg_search to handle the cases when the separator Regexp contains /\K/ (lookbehind) operator. Fixes [Bug #17113]
* Removed non-ASCII code to suppress warnings by localized compilersNobuyoshi Nakada2020-08-101-4/+4
|
* Adjust indentNobuyoshi Nakada2020-08-101-1/+1
|
* Use https instead of httpKazuhiro NISHIYAMA2020-07-281-1/+1
|
* add UNREACHABLE_RETURN卜部昌平2020-06-291-0/+2
| | | | | | Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities.
* rb_str_partition: do not goto into a branch卜部昌平2020-06-291-2/+4
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_crypt: do not goto into a branch卜部昌平2020-06-291-2/+4
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* trnext: do not goto into a branch卜部昌平2020-06-291-1/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* chompped_length: do not goto into a branch卜部昌平2020-06-291-30/+34
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* get_pat_quoted: do not goto into a branch卜部昌平2020-06-291-3/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* get_pat: do not goto into a branch卜部昌平2020-06-291-3/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_slice_bang: do not goto into a branch卜部昌平2020-06-291-7/+12
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_aset: do not goto into a branch卜部昌平2020-06-291-11/+6
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_subpat_set: do not goto into a branch卜部昌平2020-06-291-5/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_update: do not goto into a branch卜部昌平2020-06-291-5/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_match: do not goto into a branch卜部昌平2020-06-291-3/+1
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_rindex_m: do not goto into a branch卜部昌平2020-06-291-19/+4
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_str_index_m: do not goto into a branch卜部昌平2020-06-291-19/+4
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_enc_cr_str_buf_cat: do not goto into a branch卜部昌平2020-06-291-3/+5
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* add static modifier for rb_str_ord funcS-H-GAMELINKS2020-05-271-1/+1
|
* Fix typos [ci skip]Kazuhiro NISHIYAMA2020-05-171-5/+5
|
* [ci skip] Enhanced rdoc for String.new (#3067)Burdette Lamar2020-05-151-15/+88
| | | | | | | * Per @nobu review * Enhanced rdoc for String.new * Respond to review
* Optimize String#splitNobuyoshi Nakada2020-05-121-26/+52
| | | | | | | | | | | | | | | | | | Optimized `String#split` with `/ /` (single space regexp) as simple string splitting. [ruby-core:98272] | |compare-ruby|built-ruby| |:--------------|-----------:|---------:| |re_space-1 | 432.786k| 1.539M| | | -| 3.56x| |re_space-10 | 76.231k| 191.547k| | | -| 2.51x| |re_space-100 | 8.152k| 19.557k| | | -| 2.40x| |re_space-1000 | 837.405| 2.022k| | | -| 2.41x| ruby-core:98272: https://bugs.ruby-lang.org/issues/15771#change-85511
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* remove unused rb_str_clear define (#3059)S.H2020-04-251-2/+0
|
* Use UNREACHABLE_RETURN for non-void functionNobuyoshi Nakada2020-04-161-2/+1
|
* Add {Regexp,String}#match with block to call-seq [ci skip]Kazuhiro NISHIYAMA2020-04-141-2/+2
|