mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
19991117
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aa6ca26e8b
commit
b1d45b805c
7 changed files with 45 additions and 19 deletions
1
MANIFEST
1
MANIFEST
|
@ -89,6 +89,7 @@ lib/Env.rb
|
|||
lib/README
|
||||
lib/base64.rb
|
||||
lib/cgi.rb
|
||||
lib/cgi/session.rb
|
||||
lib/cgi-lib.rb
|
||||
lib/complex.rb
|
||||
lib/date.rb
|
||||
|
|
|
@ -78,6 +78,16 @@ class PStore
|
|||
begin
|
||||
@transaction = true
|
||||
value = file = nil
|
||||
lock = @filename + ".lock"
|
||||
loop do
|
||||
begin
|
||||
File::symlink("pstore::#$$", lock)
|
||||
break
|
||||
rescue Errno::EEXIST
|
||||
rescue
|
||||
sleep 1
|
||||
end
|
||||
end
|
||||
begin
|
||||
File::open(@filename, "r") do |file|
|
||||
@table = Marshal.load(file)
|
||||
|
@ -112,6 +122,7 @@ class PStore
|
|||
ensure
|
||||
@table = nil
|
||||
@transaction = false
|
||||
File::unlink(lock)
|
||||
end
|
||||
value
|
||||
end
|
||||
|
|
|
@ -14,6 +14,7 @@ module Singleton
|
|||
def Singleton.append_features(klass)
|
||||
klass.private_class_method(:new)
|
||||
klass.instance_eval %{
|
||||
@__instance__ = nil
|
||||
def instance
|
||||
unless @__instance__
|
||||
@__instance__ = new
|
||||
|
|
27
re.c
27
re.c
|
@ -182,6 +182,21 @@ kcode_reset_option()
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
rb_mbclen2(c, re)
|
||||
unsigned char c;
|
||||
VALUE re;
|
||||
{
|
||||
int len;
|
||||
|
||||
if (!FL_TEST(re, KCODE_FIXED))
|
||||
return mbclen(c);
|
||||
kcode_set_option(re);
|
||||
len = mbclen(c);
|
||||
kcode_reset_option();
|
||||
return len;
|
||||
}
|
||||
|
||||
extern int ruby_in_compile;
|
||||
|
||||
static void
|
||||
|
@ -260,10 +275,7 @@ static VALUE
|
|||
rb_reg_source(re)
|
||||
VALUE re;
|
||||
{
|
||||
VALUE str = rb_str_new(0,0);
|
||||
rb_reg_expr_str(str, RREGEXP(re)->str,RREGEXP(re)->len);
|
||||
|
||||
return str;
|
||||
return rb_str_new(RREGEXP(re)->str,RREGEXP(re)->len);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -538,6 +550,7 @@ rb_reg_search(reg, str, pos, reverse)
|
|||
}
|
||||
result = re_search(RREGEXP(reg)->ptr,RSTRING(str)->ptr,RSTRING(str)->len,
|
||||
pos, range, regs);
|
||||
|
||||
if (FL_TEST(reg, KCODE_FIXED))
|
||||
kcode_reset_option();
|
||||
|
||||
|
@ -710,7 +723,7 @@ static VALUE
|
|||
match_string(match)
|
||||
VALUE match;
|
||||
{
|
||||
return rb_str_dup(RMATCH(match)->str);
|
||||
return RMATCH(match)->str; /* str is frozen */
|
||||
}
|
||||
|
||||
VALUE rb_cRegexp;
|
||||
|
@ -1263,7 +1276,9 @@ Init_Regexp()
|
|||
rb_global_variable(®_cache);
|
||||
rb_global_variable(&matchcache);
|
||||
|
||||
rb_cMatch = rb_define_class("MatchingData", rb_cData);
|
||||
rb_cMatch = rb_define_class("MatchingData", rb_cObject);
|
||||
rb_undef_method(CLASS_OF(rb_cMatch), "new");
|
||||
|
||||
rb_define_method(rb_cMatch, "clone", match_clone, 0);
|
||||
rb_define_method(rb_cMatch, "size", match_size, 0);
|
||||
rb_define_method(rb_cMatch, "length", match_size, 0);
|
||||
|
|
3
re.h
3
re.h
|
@ -36,4 +36,7 @@ VALUE rb_reg_regsub _((VALUE, VALUE, struct re_registers *));
|
|||
int rb_kcode _((void));
|
||||
|
||||
extern int ruby_ignorecase;
|
||||
|
||||
int rb_mbclen2 _((unsigned char, VALUE));
|
||||
#define mbclen2(c,re) rb_mbclen2((c),(re))
|
||||
#endif
|
||||
|
|
17
string.c
17
string.c
|
@ -112,9 +112,10 @@ rb_str_new4(orig)
|
|||
str->ptr = RSTRING(orig)->ptr;
|
||||
RSTRING(orig)->orig = (VALUE)str;
|
||||
str->orig = 0;
|
||||
if (FL_TEST(str, FL_TAINT)) {
|
||||
if (FL_TEST(orig, FL_TAINT)) {
|
||||
FL_SET(str, FL_TAINT);
|
||||
}
|
||||
FL_SET(str, STR_FREEZE);
|
||||
return (VALUE)str;
|
||||
}
|
||||
}
|
||||
|
@ -1111,7 +1112,7 @@ rb_str_gsub_bang(argc, argv, str)
|
|||
* Always consume at least one character of the input string
|
||||
* in order to prevent infinite loops.
|
||||
*/
|
||||
len = mbclen(RSTRING(str)->ptr[END(0)]);
|
||||
len = mbclen2(RSTRING(str)->ptr[END(0)], pat);
|
||||
if (RSTRING(str)->len > END(0)) {
|
||||
memcpy(bp, RSTRING(str)->ptr+END(0), len);
|
||||
bp += len;
|
||||
|
@ -1344,12 +1345,6 @@ rb_str_inspect(str)
|
|||
*b++ = *p++;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else if ((c & 0x80) && rb_kcode() != MBCTYPE_EUC) {
|
||||
CHECK(1);
|
||||
*b++ = c;
|
||||
}
|
||||
#endif
|
||||
else if (c == '"'|| c == '\\') {
|
||||
CHECK(2);
|
||||
*b++ = '\\';
|
||||
|
@ -2084,11 +2079,11 @@ rb_str_split_method(argc, argv, str)
|
|||
regs = RMATCH(rb_backref_get())->regs;
|
||||
if (start == end && BEG(0) == END(0)) {
|
||||
if (last_null == 1) {
|
||||
rb_ary_push(result, rb_str_substr(str, beg, mbclen(RSTRING(str)->ptr[beg])));
|
||||
rb_ary_push(result, rb_str_substr(str, beg, mbclen2(RSTRING(str)->ptr[beg],spat)));
|
||||
beg = start;
|
||||
}
|
||||
else {
|
||||
start += mbclen(RSTRING(str)->ptr[start]);
|
||||
start += mbclen2(RSTRING(str)->ptr[start],spat);
|
||||
last_null = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -2398,7 +2393,7 @@ scan_once(str, pat, start)
|
|||
/*
|
||||
* Always consume at least one character of the input string
|
||||
*/
|
||||
*start = END(0)+mbclen(RSTRING(str)->ptr[END(0)]);
|
||||
*start = END(0)+mbclen2(RSTRING(str)->ptr[END(0)],pat);
|
||||
}
|
||||
else {
|
||||
*start = END(0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.4.3"
|
||||
#define RUBY_RELEASE_DATE "1999-10-12"
|
||||
#define RUBY_RELEASE_DATE "1999-11-17"
|
||||
#define RUBY_VERSION_CODE 143
|
||||
#define RUBY_RELEASE_CODE 19991012
|
||||
#define RUBY_RELEASE_CODE 19991117
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue