summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2021-09-16Adjust indent in string.c [ci skip]Nobuyoshi Nakada
2021-09-15Refactor and Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4837 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-11Remove printf family from the mjit headerNobuyoshi Nakada
Linking printf family functions makes mjit objects to link unnecessary code. Notes: Merged: https://github.com/ruby/ruby/pull/4820
2021-09-10include/ruby/internal/intern/string.h: add doygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-08[Bug #18154] Fix memory leak in String#initializePeter Zhu
String#initialize can leak memory when called on a string that is marked with STR_NOFREE because it does not unset the STR_NOFREE flag. Notes: Merged: https://github.com/ruby/ruby/pull/4814
2021-08-17Treat NULL fake string as an empty stringNobuyoshi Nakada
And the NULL string must be of size 0.
2021-08-11Term fill in String#{,l,r}strip! even when SHARABLE_MIDDLE_SUBSTRINGJeremy Evans
Each of these methods calls str_modify_keep_cr before term filling, which should ensure the backing string uses private memory, and therefore term filling should not affect other strings. Skipping the term filling was added in a707ab4bc8a29241440f56696098efa2f7f3ff45. Fixes [Bug #12540] Notes: Merged: https://github.com/ruby/ruby/pull/4731
2021-08-03Fix indentation in string.cPeter Zhu
7 spaces were used for 2 levels of indentation. This commit changes it to use 8 spaces. Notes: Merged: https://github.com/ruby/ruby/pull/4706
2021-08-02Fix documentation of #<=> and #casecmp [ci skip]Troy Chance
Descriptions for return values of -1 and 1 were reversed. Notes: Merged: https://github.com/ruby/ruby/pull/4698 Merged-By: nobu <nobu@ruby-lang.org>
2021-08-02Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-24Escape unprintable chars only, without surrounding quotesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4676
2021-07-07Refactor rb_str_export and rb_str_export_locale function'sS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4628
2021-06-30Specify version to remove as bare numbersNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3972
2021-06-30rb_warn_deprecated_to_remove_at [Feature #17432]Nobuyoshi Nakada
At compilation time with RUBY_DEBUG enabled, check if the removal version has been reached. Notes: Merged: https://github.com/ruby/ruby/pull/3972
2021-06-26Scan the coderange in the given encodingNobuyoshi Nakada
2021-06-23Add Related link from String#hash to Object#hashKetan Bhatt
We came across a bug in our code because we assumed `String#hash` to be consistent across Ruby processes, which was incorrect. Our search lead us to `Object#hash` which has the right warning that `String#hash` doesn't. We also noticed that a previous version of the documentation for `String#hash` pointed to `Object#hash` that was removed by https://github.com/ruby/ruby/pull/3565. We think this removal might not be intended and just got missed amidst other changes. Notes: Merged: https://github.com/ruby/ruby/pull/4498
2021-06-21What's Here for Numeric and ComparableBurdette Lamar
2021-06-17Adjust styles [ci skip]Nobuyoshi Nakada
* --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
2021-04-13Make String#crypt ractor-safeNobuyoshi Nakada
2021-04-12Get rid of LONG_LONG redefinitionNobuyoshi Nakada
2021-03-22rb_enc_interned_str: handle autoloaded encodingsJean Boussier
If called with an autoloaded encoding that was not yet initialized, `rb_enc_interned_str` would crash with a NULL pointer exception. See: https://github.com/ruby/ruby/pull/4119#issuecomment-800189841 Notes: Merged: https://github.com/ruby/ruby/pull/4290
2021-02-20Make String#{strip,lstrip}{,!} strip leading NUL bytesJeremy Evans
The documentation already specifies that they strip whitespace and defines whitespace to include null. This wraps the new behavior in the appropriate guards in the specs, but does not specify behavior for previous versions, because this is a bug that could be backported. Fixes [Bug #17467] Notes: Merged: https://github.com/ruby/ruby/pull/4164
2021-02-12correct the result of casecmp? examples [ci skip]Sarun Rattanasiri
Notes: Merged: https://github.com/ruby/ruby/pull/4174 Merged-By: nobu <nobu@ruby-lang.org>
2021-02-11Merged too-short salt conditions instead of UNREACHABLE_RETURNNobuyoshi Nakada
2021-02-11Fix 404 linkS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4169
2021-02-04Remove unsued str_new_shared function declarationS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4151
2021-01-30Constified pointers in str_casecmpNobuyoshi Nakada
2021-01-26Fix broken link in RDoc for String (#4123)Burdette Lamar
Link was correct; its target was incorrect; now fixed. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-01-22What's Here for String RDoc (#4093)Burdette Lamar
* What's Here for String RDoc Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-12-30Minor grammar fix in String#chomp documentationEric Schneider
Notes: Merged: https://github.com/ruby/ruby/pull/4013
2020-12-26Use `size_t` for `RSTRING_LEN` in String#countNobuyoshi Nakada
https://hackerone.com/reports/1042722 Notes: Merged: https://github.com/ruby/ruby/pull/4001
2020-12-21Add Symbol#name and freezing explanation to #to_szverok
Notes: Merged: https://github.com/ruby/ruby/pull/3966
2020-12-21Replaced magic numbers tr tableNobuyoshi Nakada
2020-12-18Use category: :deprecated in warnings that are related to deprecationJeremy Evans
Also document that both :deprecated and :experimental are supported :category option values. The locations where warnings were marked as deprecation warnings was previously reviewed by shyouhei. Comment a couple locations where deprecation warnings should probably be used but are not currently used because deprecation warning enablement has not occurred at the time they are called (RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K). Add assert_deprecated_warn to test assertions. Use this to simplify some tests, and fix failing tests after marking some warnings with deprecated category. Notes: Merged: https://github.com/ruby/ruby/pull/3917
2020-12-07tuning trial: newobj with current ecKoichi Sasada
Passing current ec can improve performance of newobj. This patch tries it for Array and String literals ([] and ''). Notes: Merged: https://github.com/ruby/ruby/pull/3842
2020-12-01should not use rb_str_modify(), tooKoichi Sasada
Same as 8247b8edde, should not use rb_str_modify() here. https://bugs.ruby-lang.org/issues/17343#change-88858 Notes: Merged: https://github.com/ruby/ruby/pull/3833
2020-11-30Fix rb_interned_str_* functions to not assume static stringsJean Boussier
Fixes [Feature #13381] When passed a `fake_str`, `register_fstring` would create new strings with `str_new_static`. That's not what was expected, and answer almost no use cases. Notes: Merged: https://github.com/ruby/ruby/pull/3786
2020-11-29Get rid of allocation when the capacity is smallNobuyoshi Nakada
2020-11-20Remove obsoleted str_new_emptyTakashi Kokubun
since 58325daae3beefda13ed100782cd19a89cc68771. ../string.c:1339:1: warning: ‘str_new_empty’ defined but not used [-Wunused-function] 1339 | str_new_empty(VALUE str) | ^~~~~~~~~~~~~
2020-11-20Make String methods return String instances when called on a subclass instanceJeremy Evans
This modifies the following String methods to return String instances instead of subclass instances: * String#* * String#capitalize * String#center * String#chomp * String#chop * String#delete * String#delete_prefix * String#delete_suffix * String#downcase * String#dump * String#each/#each_line * String#gsub * String#ljust * String#lstrip * String#partition * String#reverse * String#rjust * String#rpartition * String#rstrip * String#scrub * String#slice! * String#slice/#[] * String#split * String#squeeze * String#strip * String#sub * String#succ/#next * String#swapcase * String#tr * String#tr_s * String#upcase This also fixes a bug in String#swapcase where it would return the receiver instead of a copy of the receiver if the receiver was the empty string. Some string methods were left to return subclass instances: * String#+@ * String#-@ Both of these methods will return the receiver (subclass instance) in some cases, so it is best to keep the returned class consistent. Fixes [#10845] Notes: Merged: https://github.com/ruby/ruby/pull/3701
2020-11-17Expose the rb_interned_str_* family of functionsJean Boussier
Fixes [Feature #13381] Notes: Merged: https://github.com/ruby/ruby/pull/3586
2020-10-30Move variable closer to usageAlan Wu
2020-10-21Don't redefine #rb_intern over and over againStefan Stüben
Notes: Merged: https://github.com/ruby/ruby/pull/3589
2020-10-08Enhanced RDoc for String#insert (#3643)Burdette Lamar
* Enhanced RDoc for String#insert Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-30Enhanced RDoc for String#[] (#3607)Burdette Lamar
* Enhanced RDoc for String#[] Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-29Enhanced RDoc for String#upto (#3603)Burdette Lamar
* Enhanced RDoc for String#upto Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-28Enhanced RDoc for String#succ! (#3596)Burdette Lamar
* Enhanced RDoc for String#succ! Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-25Enhanced RDoc for String#succ (#3590)Burdette Lamar
* Enhanced RDoc for String#succ Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-24Enhanced RDoc for String#match? (#3576)Burdette Lamar
* Enhanced RDoc for String#match? Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-09-24Enhanced RDoc for String (#3574)Burdette Lamar
Methods: =~ match Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>