Jeremy Evans
2a5c3a4d0f
Update documentation for String and Symbol to discuss differences
...
Implements [Feature #14347 ]
2021-10-15 13:54:03 -07:00
Nobuyoshi Nakada
78ff9b719c
Add tests for the edge caces of `String#end_with?`
...
Also, check if a suffix is empty, to guarantee the assumption of
`onigenc_get_left_adjust_char_head` that `*s` is always accessible,
even in the case of `SHARABLE_MIDDLE_SUBSTRING`.
2021-10-08 14:08:03 +09:00
git
1bf3f3f4da
* remove trailing spaces. [ci skip]
2021-10-06 00:40:54 +09:00
Jeremy Evans
c6706f15af
Fix documentation for String#{<<,concat,prepend}
...
These methods mutate and return the receiver, they don't create
and return a new string.
Fixes [Bug #18241 ]
2021-10-05 08:39:27 -07:00
Nobuyoshi Nakada
cd182c5ee1
Adjust types to rb_enc_left_char_head
...
I dislike unnatural casts.
2021-10-05 17:14:29 +09:00
Nobuyoshi Nakada
5a961c3768
Remove a redundant cast between the exact same types
2021-10-05 15:56:34 +09:00
卜部昌平
f032c09bca
rb_enc_left_char_head(): take void*
...
Nobu doesn't like (char*) cast.
2021-10-05 14:18:23 +09:00
卜部昌平
499660b04f
downcase_single/upcase_single: assume ASCII
...
These functions assume ASCII compatibility. That has to be ensured in
their caller.
2021-10-05 14:18:23 +09:00
卜部昌平
5112a54846
include/ruby/encoding.h: convert macros into inline functions
...
Less macros == huge win.
2021-10-05 14:18:23 +09:00
卜部昌平
e42c8c160d
add undeclared variables
...
Why did they even exist?
2021-10-05 14:18:23 +09:00
Nobuyoshi Nakada
842b0008c1
Skip broken strings as the locale encoding
2021-10-01 20:28:44 +09:00
Kazuhiro NISHIYAMA
e0c6e8c64a
[DOC] Use `unpack1` instead of `unpack(template)[0]` [ci skip]
2021-09-23 09:20:00 +09:00
Nobuyoshi Nakada
cbbda3e648
Adjust indent in string.c [ci skip]
2021-09-16 23:49:16 +09:00
S.H
b8c3a84bdd
Refactor and Using RBOOL macro
2021-09-15 08:11:05 +09:00
Nobuyoshi Nakada
cd829bb078
Remove printf family from the mjit header
...
Linking printf family functions makes mjit objects to link
unnecessary code.
2021-09-11 08:41:32 +09:00
卜部昌平
091faca99c
include/ruby/internal/intern/string.h: add doygen
...
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
Peter Zhu
5d81554281
[Bug #18154 ] Fix memory leak in String#initialize
...
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.
2021-09-08 10:20:12 -04:00
Nobuyoshi Nakada
edf01d4e82
Treat NULL fake string as an empty string
...
And the NULL string must be of size 0.
2021-08-17 18:45:36 +09:00
Jeremy Evans
84bf4d2ce5
Term fill in String#{,l,r}strip! even when SHARABLE_MIDDLE_SUBSTRING
...
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
a707ab4bc8
.
Fixes [Bug #12540 ]
2021-08-11 13:40:49 +09:00
Peter Zhu
c463a5e008
Fix indentation in string.c
...
7 spaces were used for 2 levels of indentation. This commit changes it
to use 8 spaces.
2021-08-03 16:39:02 -04:00
Troy Chance
7f4e86804d
Fix documentation of #<=> and #casecmp [ci skip]
...
Descriptions for return values of -1 and 1 were reversed.
2021-08-02 12:09:07 +09:00
S.H
378e8cdad6
Using RBOOL macro
2021-08-02 12:06:44 +09:00
Nobuyoshi Nakada
eec45a93ef
Escape unprintable chars only, without surrounding quotes
2021-07-24 14:31:41 +09:00
S-H-GAMELINKS
9952e9358e
Refactor rb_str_export and rb_str_export_locale function's
2021-07-07 12:31:43 +09:00
Nobuyoshi Nakada
94bd3bde81
Specify version to remove as bare numbers
2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada
8118d435d0
rb_warn_deprecated_to_remove_at [Feature #17432 ]
...
At compilation time with RUBY_DEBUG enabled, check if the removal
version has been reached.
2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada
391abc543c
Scan the coderange in the given encoding
2021-06-26 16:05:15 +09:00
Ketan Bhatt
2fb435b3ab
Add Related link from String#hash to Object#hash
...
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.
2021-06-23 07:42:02 -07:00
Burdette Lamar
c1741df1a1
What's Here for Numeric and Comparable
2021-06-21 10:38:16 -07:00
Nobuyoshi Nakada
e4f891ce8d
Adjust styles [ci skip]
...
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
2021-06-17 10:13:40 +09:00
Nobuyoshi Nakada
12f7ba5ed4
Make String#crypt ractor-safe
2021-04-13 12:05:31 +09:00
Nobuyoshi Nakada
df7efdcb6b
Get rid of LONG_LONG redefinition
2021-04-12 22:47:07 +09:00
Jean Boussier
7e8a9af9db
rb_enc_interned_str: handle autoloaded encodings
...
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
2021-03-22 21:37:48 +09:00
Jeremy Evans
cfd162d535
Make String#{strip,lstrip}{,!} strip leading NUL bytes
...
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 ]
2021-02-20 11:17:47 +09:00
Sarun Rattanasiri
1a3b68e7c1
correct the result of casecmp? examples [ci skip]
2021-02-12 06:56:51 +09:00
Nobuyoshi Nakada
81f17857a7
Merged too-short salt conditions instead of UNREACHABLE_RETURN
2021-02-11 22:25:31 +09:00
S-H-GAMELINKS
9e66c511ff
Fix 404 link
2021-02-11 13:33:21 +09:00
S-H-GAMELINKS
90f008f569
Remove unsued str_new_shared function declaration
2021-02-04 16:25:55 +09:00
Nobuyoshi Nakada
1f5b8f7084
Constified pointers in str_casecmp
2021-01-30 20:08:18 +09:00
Burdette Lamar
d7a844cb08
Fix broken link in RDoc for String ( #4123 )
...
Link was correct; its target was incorrect; now fixed.
2021-01-26 11:22:13 -06:00
Burdette Lamar
6e44de752e
What's Here for String RDoc ( #4093 )
...
* What's Here for String RDoc
2021-01-22 15:01:09 -06:00
Eric Schneider
11b8bb99e6
Minor grammar fix in String#chomp documentation
2020-12-30 01:25:00 -05:00
Nobuyoshi Nakada
6083fed366
Use `size_t` for `RSTRING_LEN` in String#count
...
https://hackerone.com/reports/1042722
2020-12-26 01:40:51 +09:00
zverok
4728c0d900
Add Symbol#name and freezing explanation to #to_s
2020-12-21 19:22:38 -05:00
Nobuyoshi Nakada
c7a5cc2c30
Replaced magic numbers tr table
2020-12-21 23:45:38 +09:00
Jeremy Evans
05313c914b
Use category: :deprecated in warnings that are related to deprecation
...
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.
2020-12-18 09:54:11 -08:00
Koichi Sasada
344ec26a99
tuning trial: newobj with current ec
...
Passing current ec can improve performance of newobj. This patch
tries it for Array and String literals ([] and '').
2020-12-07 08:28:36 +09:00
Koichi Sasada
764de7566f
should not use rb_str_modify(), too
...
Same as 8247b8edde
, should not use rb_str_modify() here.
https://bugs.ruby-lang.org/issues/17343#change-88858
2020-12-01 18:16:23 +09:00
Jean Boussier
6bef49427a
Fix rb_interned_str_* functions to not assume static strings
...
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.
2020-11-30 17:33:28 +09:00
Nobuyoshi Nakada
02c32b2e92
Get rid of allocation when the capacity is small
2020-11-29 15:01:41 +09:00