mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
string.c: no terminator
* string.c (rb_str_{,l,r}strip_bang): rb_str_subseq() will not NUL-terminate the result string, in the future, so it will not be needed in other cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7fecd1e75d
commit
a707ab4bc8
3 changed files with 20 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Nov 5 15:05:12 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_{,l,r}strip_bang): rb_str_subseq() will not
|
||||
NUL-terminate the result string, in the future, so it will not
|
||||
be needed in other cases.
|
||||
|
||||
Wed Nov 5 14:11:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* common.mk (lib/unicode_normalize/tables.rb): do nothing unless
|
||||
|
|
8
NEWS
8
NEWS
|
@ -290,10 +290,10 @@ with all sufficient information, see the ChangeLog file.
|
|||
|
||||
* rb_str_cat_cstr() added. This is same as `rb_str_cat2()`.
|
||||
|
||||
* `rb_str_substr()` and `rb_str_subseq()` now share middle of a string,
|
||||
but not only the end of a string. Therefore, result strings may not
|
||||
be NUL-terminated, `StringValueCStr()` is needed calling to obtain a
|
||||
NUL-terminated C string.
|
||||
* `rb_str_substr()` and `rb_str_subseq()` will share middle of a string,
|
||||
but not only the end of a string, in the futre. Therefore, result
|
||||
strings may not be NUL-terminated, `StringValueCStr()` is needed
|
||||
calling to obtain a NUL-terminated C string.
|
||||
|
||||
* rb_tracepoint_new() supports new internal events accessible only from C:
|
||||
* RUBY_INTERNAL_EVENT_GC_ENTER
|
||||
|
|
11
string.c
11
string.c
|
@ -128,7 +128,10 @@ VALUE rb_cSymbol;
|
|||
|
||||
#define STR_ENC_GET(str) get_encoding(str)
|
||||
|
||||
#if 1
|
||||
#if !defined SHARABLE_MIDDLE_SUBSTRING
|
||||
# define SHARABLE_MIDDLE_SUBSTRING 0
|
||||
#endif
|
||||
#if !SHARABLE_MIDDLE_SUBSTRING
|
||||
#define SHARABLE_SUBSTRING_P(beg, len, end) ((beg) + (len) == (end))
|
||||
#else
|
||||
#define SHARABLE_SUBSTRING_P(beg, len, end) 1
|
||||
|
@ -7227,7 +7230,9 @@ rb_str_lstrip_bang(VALUE str)
|
|||
s = start + loffset;
|
||||
memmove(start, s, len);
|
||||
STR_SET_LEN(str, len);
|
||||
#if !SHARABLE_MIDDLE_SUBSTRING
|
||||
TERM_FILL(start+len, rb_enc_mbminlen(enc));
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
return Qnil;
|
||||
|
@ -7309,7 +7314,9 @@ rb_str_rstrip_bang(VALUE str)
|
|||
long len = olen - roffset;
|
||||
|
||||
STR_SET_LEN(str, len);
|
||||
#if !SHARABLE_MIDDLE_SUBSTRING
|
||||
TERM_FILL(start+len, rb_enc_mbminlen(enc));
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
return Qnil;
|
||||
|
@ -7371,7 +7378,9 @@ rb_str_strip_bang(VALUE str)
|
|||
memmove(start, start + loffset, len);
|
||||
}
|
||||
STR_SET_LEN(str, len);
|
||||
#if !SHARABLE_MIDDLE_SUBSTRING
|
||||
TERM_FILL(start+len, rb_enc_mbminlen(enc));
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
return Qnil;
|
||||
|
|
Loading…
Add table
Reference in a new issue