mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (str_alloc): specify 'inline' modifier.
* string.c (str_alloc): remove cSymbol hack that no longer necessary. * string.c (scan_once): avoid retrieving encoding info unless necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
768380583a
commit
c3ab4a4b1b
2 changed files with 12 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Thu Jun 19 17:37:21 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (str_alloc): specify 'inline' modifier.
|
||||||
|
|
||||||
|
* string.c (str_alloc): remove cSymbol hack that no longer
|
||||||
|
necessary.
|
||||||
|
|
||||||
|
* string.c (scan_once): avoid retrieving encoding info unless
|
||||||
|
necessary.
|
||||||
|
|
||||||
Thu Jun 19 17:19:14 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Jun 19 17:19:14 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_scan): String#scan should preserve last
|
* string.c (rb_str_scan): String#scan should preserve last
|
||||||
|
|
9
string.c
9
string.c
|
@ -336,16 +336,12 @@ str_frozen_check(VALUE s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static inline VALUE
|
||||||
str_alloc(VALUE klass)
|
str_alloc(VALUE klass)
|
||||||
{
|
{
|
||||||
NEWOBJ(str, struct RString);
|
NEWOBJ(str, struct RString);
|
||||||
OBJSETUP(str, klass, T_STRING);
|
OBJSETUP(str, klass, T_STRING);
|
||||||
|
|
||||||
if (klass == rb_cSymbol) {
|
|
||||||
/* need to be registered in table */
|
|
||||||
RBASIC(str)->klass = rb_cString;
|
|
||||||
}
|
|
||||||
str->as.heap.ptr = 0;
|
str->as.heap.ptr = 0;
|
||||||
str->as.heap.len = 0;
|
str->as.heap.len = 0;
|
||||||
str->as.heap.aux.capa = 0;
|
str->as.heap.aux.capa = 0;
|
||||||
|
@ -5617,16 +5613,15 @@ rb_str_strip(VALUE str)
|
||||||
static VALUE
|
static VALUE
|
||||||
scan_once(VALUE str, VALUE pat, long *start)
|
scan_once(VALUE str, VALUE pat, long *start)
|
||||||
{
|
{
|
||||||
rb_encoding *enc;
|
|
||||||
VALUE result, match;
|
VALUE result, match;
|
||||||
struct re_registers *regs;
|
struct re_registers *regs;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
enc = STR_ENC_GET(str);
|
|
||||||
if (rb_reg_search(pat, str, *start, 0) >= 0) {
|
if (rb_reg_search(pat, str, *start, 0) >= 0) {
|
||||||
match = rb_backref_get();
|
match = rb_backref_get();
|
||||||
regs = RMATCH_REGS(match);
|
regs = RMATCH_REGS(match);
|
||||||
if (BEG(0) == END(0)) {
|
if (BEG(0) == END(0)) {
|
||||||
|
rb_encoding *enc = STR_ENC_GET(str);
|
||||||
/*
|
/*
|
||||||
* Always consume at least one character of the input string
|
* Always consume at least one character of the input string
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue