mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ef45458e94
commit
1ce6f065b5
16 changed files with 113 additions and 74 deletions
28
ChangeLog
28
ChangeLog
|
@ -1,9 +1,37 @@
|
|||
Tue Oct 10 09:49:23 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* file.c (Init_File): FileTest.size should return 0 (not nil) for
|
||||
empty files.
|
||||
|
||||
Sun Oct 8 13:20:26 2000 Guy Decoux <decoux@moulon.inra.fr>
|
||||
|
||||
* eval.c (POP_SCOPE): not just set SCOPE_DONT_RECYCLE, but do
|
||||
scope_dup().
|
||||
|
||||
Sat Oct 7 15:10:50 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_reverse_bang): unnecessary ALLOCA_N() was
|
||||
removed.
|
||||
|
||||
Fri Oct 6 14:50:24 2000 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* ext/extmk.rb.in, lib/mkmf.rb: remove "DESTDIR =".
|
||||
|
||||
* Makefile.in, win32/Makefile.sub, ruby.1: renamed -X to -C.
|
||||
|
||||
Fri Oct 6 12:50:52 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* array.c (rb_ary_plus): use to_ary(), not Check_Type().
|
||||
|
||||
* array.c (rb_ary_concat): ditto.
|
||||
|
||||
* gc.c (rb_gc): use __builtin_frame_address() for gcc.
|
||||
|
||||
* eval.c (stack_length): ditto.
|
||||
|
||||
* parse.y (assign_in_cond): stop warning till some better warning
|
||||
condition will be found.
|
||||
|
||||
Thu Oct 5 18:02:39 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* object.c (rb_obj_dup): should have propagated taint flag.
|
||||
|
|
16
array.c
16
array.c
|
@ -278,6 +278,9 @@ rb_ary_push_m(argc, argv, ary)
|
|||
VALUE *argv;
|
||||
VALUE ary;
|
||||
{
|
||||
if (argc == 0) {
|
||||
rb_raise(rb_eArgError, "wrong # of arguments(at least 1)");
|
||||
}
|
||||
if (argc > 0) {
|
||||
long len = RARRAY(ary)->len;
|
||||
|
||||
|
@ -903,9 +906,8 @@ rb_ary_reverse(ary)
|
|||
|
||||
while (p1 < p2) {
|
||||
tmp = *p1;
|
||||
*p1 = *p2;
|
||||
*p2 = tmp;
|
||||
p1++; p2--;
|
||||
*p1++ = *p2;
|
||||
*p2-- = tmp;
|
||||
}
|
||||
|
||||
return ary;
|
||||
|
@ -1236,8 +1238,7 @@ rb_ary_plus(x, y)
|
|||
{
|
||||
VALUE z;
|
||||
|
||||
Check_Type(y, T_ARRAY);
|
||||
|
||||
y = to_ary(y);
|
||||
z = rb_ary_new2(RARRAY(x)->len + RARRAY(y)->len);
|
||||
MEMCPY(RARRAY(z)->ptr, RARRAY(x)->ptr, VALUE, RARRAY(x)->len);
|
||||
MEMCPY(RARRAY(z)->ptr+RARRAY(x)->len, RARRAY(y)->ptr, VALUE, RARRAY(y)->len);
|
||||
|
@ -1249,9 +1250,10 @@ VALUE
|
|||
rb_ary_concat(x, y)
|
||||
VALUE x, y;
|
||||
{
|
||||
Check_Type(y, T_ARRAY);
|
||||
|
||||
y = to_ary(y);
|
||||
if (RARRAY(y)->len > 0) {
|
||||
rb_ary_push_m(RARRAY(y)->len, RARRAY(y)->ptr, x);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
|
21
eval.c
21
eval.c
|
@ -796,10 +796,12 @@ static VALUE ruby_wrapper; /* security wrapper */
|
|||
|
||||
typedef struct thread * rb_thread_t;
|
||||
static rb_thread_t curr_thread = 0;
|
||||
static void scope_dup _((struct SCOPE *));
|
||||
|
||||
#define POP_SCOPE() \
|
||||
if (ruby_scope->flag & SCOPE_DONT_RECYCLE) {\
|
||||
if (_old) _old->flag |= SCOPE_DONT_RECYCLE;\
|
||||
if (_old)\
|
||||
scope_dup(_old);\
|
||||
} \
|
||||
if (!(ruby_scope->flag & SCOPE_MALLOC)) {\
|
||||
ruby_scope->local_vars = 0; \
|
||||
|
@ -1259,7 +1261,7 @@ rb_eval_cmd(cmd, arg)
|
|||
}
|
||||
|
||||
if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
|
||||
saved_scope->flag |= SCOPE_DONT_RECYCLE;
|
||||
scope_dup(saved_scope);
|
||||
ruby_scope = saved_scope;
|
||||
ruby_safe_level = safe;
|
||||
POP_TAG();
|
||||
|
@ -3499,7 +3501,7 @@ rb_yield_0(val, self, klass, acheck)
|
|||
ruby_block = block;
|
||||
ruby_frame = ruby_frame->prev;
|
||||
if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
|
||||
old_scope->flag |= SCOPE_DONT_RECYCLE;
|
||||
scope_dup(old_scope);
|
||||
ruby_scope = old_scope;
|
||||
if (state) JUMP_TAG(state);
|
||||
return result;
|
||||
|
@ -3993,8 +3995,12 @@ stack_length(p)
|
|||
VALUE stack_end;
|
||||
alloca(0);
|
||||
# define STACK_END (&stack_end)
|
||||
#else
|
||||
# if defined(__GNUC__)
|
||||
VALUE *stack_end = __builtin_frame_address(0);
|
||||
# else
|
||||
VALUE *stack_end = alloca(1);
|
||||
# endif
|
||||
# define STACK_END (stack_end)
|
||||
#endif
|
||||
if (p) *p = STACK_END;
|
||||
|
@ -4659,7 +4665,7 @@ eval(self, src, scope, file, line)
|
|||
if (!NIL_P(scope)) {
|
||||
ruby_frame = frame.tmp;
|
||||
if (ruby_scope->flag & SCOPE_DONT_RECYCLE)
|
||||
old_scope->flag |= SCOPE_DONT_RECYCLE;
|
||||
scope_dup(old_scope);
|
||||
ruby_scope = old_scope;
|
||||
ruby_block = old_block;
|
||||
ruby_dyna_vars = old_d_vars;
|
||||
|
@ -8164,9 +8170,8 @@ rb_thread_inspect(thread)
|
|||
default:
|
||||
status = "unknown"; break;
|
||||
}
|
||||
s = ALLOCA_N(char, strlen(cname)+6+16+9+1); /* 6:tags 16:addr 9:status 1:nul */
|
||||
sprintf(s, "#<%s:0x%lx %s>", cname, thread, status);
|
||||
str = rb_str_new2(s);
|
||||
str = rb_str_new(0, strlen(cname)+6+16+9+1); /* 6:tags 16:addr 9:status 1:nul */
|
||||
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx %s>", cname, thread, status);
|
||||
OBJ_INFECT(str, thread);
|
||||
|
||||
return str;
|
||||
|
@ -8187,7 +8192,7 @@ rb_callcc(self)
|
|||
cont = Data_Wrap_Struct(rb_cCont, thread_mark,
|
||||
thread_free, th);
|
||||
|
||||
ruby_scope->flag |= SCOPE_DONT_RECYCLE;
|
||||
scope_dup(ruby_scope);
|
||||
for (tag=prot_tag; tag; tag=tag->prev) {
|
||||
scope_dup(tag->scope);
|
||||
}
|
||||
|
|
3
file.c
3
file.c
|
@ -2172,7 +2172,7 @@ Init_File()
|
|||
define_filetest_function("file?", test_f, 1);
|
||||
define_filetest_function("zero?", test_z, 1);
|
||||
define_filetest_function("size?", test_s, 1);
|
||||
define_filetest_function("size", test_s, 1);
|
||||
define_filetest_function("size", rb_file_s_size, 1);
|
||||
define_filetest_function("owned?", test_owned, 1);
|
||||
define_filetest_function("grpowned?", test_grpowned, 1);
|
||||
|
||||
|
@ -2194,7 +2194,6 @@ Init_File()
|
|||
rb_define_singleton_method(rb_cFile, "atime", rb_file_s_atime, 1);
|
||||
rb_define_singleton_method(rb_cFile, "mtime", rb_file_s_mtime, 1);
|
||||
rb_define_singleton_method(rb_cFile, "ctime", rb_file_s_ctime, 1);
|
||||
rb_define_singleton_method(rb_cFile, "size", rb_file_s_size, 1);
|
||||
|
||||
rb_define_singleton_method(rb_cFile, "utime", rb_file_s_utime, -1);
|
||||
rb_define_singleton_method(rb_cFile, "chmod", rb_file_s_chmod, -1);
|
||||
|
|
8
gc.c
8
gc.c
|
@ -904,8 +904,12 @@ rb_gc()
|
|||
VALUE stack_end;
|
||||
alloca(0);
|
||||
# define STACK_END (&stack_end)
|
||||
#else
|
||||
# if defined(__GNUC__)
|
||||
VALUE *stack_end = __builtin_frame_address(0);
|
||||
# else
|
||||
VALUE *stack_end = alloca(1);
|
||||
# endif
|
||||
# define STACK_END (stack_end)
|
||||
#endif
|
||||
|
||||
|
@ -978,9 +982,11 @@ void
|
|||
Init_stack(addr)
|
||||
VALUE *addr;
|
||||
{
|
||||
#ifdef __human68k__
|
||||
#if defined(__human68k__)
|
||||
extern void *_SEND;
|
||||
rb_gc_stack_start = _SEND;
|
||||
#elsif defined(__GNUC__)
|
||||
rb_gc_stack_start = __builtin_frame_address(2);
|
||||
#else
|
||||
VALUE start;
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ class CGI
|
|||
|
||||
|
||||
=begin
|
||||
=== ESCAPE HTML &"<>
|
||||
=== ESCAPE HTML &\"<>
|
||||
CGI::escapeHTML("string")
|
||||
=end
|
||||
def CGI::escapeHTML(string)
|
||||
|
|
|
@ -9,7 +9,7 @@ class Mail
|
|||
@header = {}
|
||||
@body = []
|
||||
begin
|
||||
while line = f.gets()
|
||||
f.each do |line|
|
||||
line.chop!
|
||||
next if /^From /=~line # skip From-line
|
||||
break if /^$/=~line # end of header
|
||||
|
|
|
@ -442,7 +442,6 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(cond
|
||||
((nth 0 state) ; within string
|
||||
(setq indent nil)) ; do nothing
|
||||
|
||||
((car (nth 1 state)) ; in paren
|
||||
(goto-char (cdr (nth 1 state)))
|
||||
(if (eq (car (nth 1 state)) ?\( )
|
||||
|
@ -464,7 +463,6 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(back-to-indentation)
|
||||
(setq indent (ruby-indent-size (current-column) (nth 2 state)))))
|
||||
))
|
||||
|
||||
((and (nth 2 state)(> (nth 2 state) 0)) ; in nest
|
||||
(if (null (cdr (nth 1 state)))
|
||||
(error "invalid nest"))
|
||||
|
@ -514,7 +512,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(setq end (point))
|
||||
(beginning-of-line)
|
||||
(if (re-search-forward "^\\s *#" end t)
|
||||
(beginning-of-line)
|
||||
(forward-line 1)
|
||||
(setq done t))))
|
||||
(setq bol (point))
|
||||
(end-of-line)
|
||||
|
@ -538,9 +536,10 @@ The variable ruby-indent-level controls the amount of indentation.
|
|||
(goto-char (match-end 0))
|
||||
(not (looking-at "[a-z_]"))))
|
||||
(and (looking-at ruby-operator-re)
|
||||
(not (eq (char-after (1- (point))) ??))
|
||||
(not (eq (char-after (1- (point))) ?$))
|
||||
(or (not (eq ?/ (char-after (point))))
|
||||
(null (nth 0 (ruby-parse-region parse-start (point)))))
|
||||
(not (eq (char-after (1- (point))) ?$))
|
||||
(or (not (eq ?| (char-after (point))))
|
||||
(save-excursion
|
||||
(or (eolp) (forward-char -1))
|
||||
|
|
29
object.c
29
object.c
|
@ -129,13 +129,11 @@ VALUE
|
|||
rb_any_to_s(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
char *s;
|
||||
char *cname = rb_class2name(CLASS_OF(obj));
|
||||
VALUE str;
|
||||
|
||||
s = ALLOCA_N(char, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:eos */
|
||||
sprintf(s, "#<%s:0x%lx>", cname, obj);
|
||||
str = rb_str_new2(s);
|
||||
str = rb_str_new(0, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:eos */
|
||||
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx>", cname, obj);
|
||||
if (OBJ_TAINTED(obj)) OBJ_TAINT(str);
|
||||
|
||||
return str;
|
||||
|
@ -195,17 +193,16 @@ rb_obj_inspect(obj)
|
|||
&& ROBJECT(obj)->iv_tbl
|
||||
&& ROBJECT(obj)->iv_tbl->num_entries > 0) {
|
||||
VALUE str;
|
||||
char *c, *b;
|
||||
char *c;
|
||||
|
||||
c = rb_class2name(CLASS_OF(obj));
|
||||
if (rb_inspecting_p(obj)) {
|
||||
b = ALLOCA_N(char, strlen(c)+8+16+1); /* 8:tags 16:addr 1:eos */
|
||||
sprintf(b, "#<%s:0x%lx ...>", c, obj);
|
||||
return rb_str_new2(b);
|
||||
str = rb_str_new(0, strlen(c)+8+16+1); /* 8:tags 16:addr 1:eos */
|
||||
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx ...>", c, obj);
|
||||
return str;
|
||||
}
|
||||
b = ALLOCA_N(char, strlen(c)+4+16+1); /* 4:tags 16:addr 1:eos */
|
||||
sprintf(b, "-<%s:0x%lx ", c, obj);
|
||||
str = rb_str_new2(b);
|
||||
str = rb_str_new(0, strlen(c)+4+16+1); /* 4:tags 16:addr 1:eos */
|
||||
sprintf(RSTRING(str)->ptr, "-<%s:0x%lx ", c, obj);
|
||||
return rb_protect_inspect(inspect_obj, obj, str);
|
||||
}
|
||||
return rb_funcall(obj, rb_intern("to_s"), 0, 0);
|
||||
|
@ -495,13 +492,13 @@ static VALUE
|
|||
sym_inspect(sym)
|
||||
VALUE sym;
|
||||
{
|
||||
char *name, *buf;
|
||||
VALUE str;
|
||||
char *name;
|
||||
|
||||
str = rb_str_new(0, strlen(name)+2);
|
||||
name = rb_id2name(SYM2ID(sym));
|
||||
buf = ALLOCA_N(char, strlen(name)+2);
|
||||
sprintf(buf, ":%s", name);
|
||||
|
||||
return rb_str_new2(buf);
|
||||
sprintf(RSTRING(str)->ptr, ":%s", name);
|
||||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
12
parse.y
12
parse.y
|
@ -4342,11 +4342,6 @@ assign_in_cond(node)
|
|||
switch (nd_type(node->nd_value)) {
|
||||
case NODE_LIT:
|
||||
case NODE_STR:
|
||||
case NODE_DSTR:
|
||||
case NODE_XSTR:
|
||||
case NODE_DXSTR:
|
||||
case NODE_EVSTR:
|
||||
case NODE_DREGX:
|
||||
case NODE_NIL:
|
||||
case NODE_TRUE:
|
||||
case NODE_FALSE:
|
||||
|
@ -4354,12 +4349,19 @@ assign_in_cond(node)
|
|||
rb_warn("found = in conditional, should be ==");
|
||||
return 1;
|
||||
|
||||
case NODE_DSTR:
|
||||
case NODE_XSTR:
|
||||
case NODE_DXSTR:
|
||||
case NODE_EVSTR:
|
||||
case NODE_DREGX:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
if (assign_in_cond(node->nd_value) == 0) {
|
||||
rb_warning("assignment in condition");
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
9
re.c
9
re.c
|
@ -1038,7 +1038,7 @@ rb_reg_s_quote(argc, argv)
|
|||
VALUE str, kcode;
|
||||
int kcode_saved = reg_kcode;
|
||||
char *s, *send, *t;
|
||||
char *tmp;
|
||||
VALUE tmp;
|
||||
int len;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &str, &kcode);
|
||||
|
@ -1049,8 +1049,8 @@ rb_reg_s_quote(argc, argv)
|
|||
}
|
||||
s = rb_str2cstr(str, &len);
|
||||
send = s + len;
|
||||
tmp = ALLOCA_N(char, len*2);
|
||||
t = tmp;
|
||||
tmp = rb_str_new(0, len*2);
|
||||
t = RSTRING(tmp)->ptr;
|
||||
|
||||
for (; s < send; s++) {
|
||||
if (ismbchar(*s)) {
|
||||
|
@ -1073,8 +1073,9 @@ rb_reg_s_quote(argc, argv)
|
|||
*t++ = *s;
|
||||
}
|
||||
kcode_reset_option();
|
||||
rb_str_resize(tmp, t - RSTRING(tmp)->ptr);
|
||||
|
||||
return rb_str_new(tmp, t - tmp);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -50,8 +50,8 @@ end
|
|||
$outcount = 0;
|
||||
def fromout(date, from, subj)
|
||||
return if !date
|
||||
y = m = d = 0
|
||||
y, m, d = parsedate(date) if date
|
||||
y ||= 0; m ||= 0; d ||= 0
|
||||
if from
|
||||
from.gsub! /\n/, ""
|
||||
else
|
||||
|
|
12
string.c
12
string.c
|
@ -1381,16 +1381,16 @@ static VALUE
|
|||
rb_str_reverse_bang(str)
|
||||
VALUE str;
|
||||
{
|
||||
char *s, *e, *p, *q;
|
||||
char *s, *e;
|
||||
char c;
|
||||
|
||||
s = RSTRING(str)->ptr;
|
||||
e = s + RSTRING(str)->len - 1;
|
||||
p = q = ALLOCA_N(char, RSTRING(str)->len);
|
||||
|
||||
while (e >= s) {
|
||||
*p++ = *e--;
|
||||
while (s < e) {
|
||||
c = *s;
|
||||
*s++ = *e;
|
||||
*e-- = c;
|
||||
}
|
||||
MEMCPY(RSTRING(str)->ptr, q, char, RSTRING(str)->len);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
12
struct.c
12
struct.c
|
@ -338,10 +338,10 @@ rb_struct_to_s(s)
|
|||
VALUE s;
|
||||
{
|
||||
char *cname = rb_class2name(CLASS_OF(s));
|
||||
char *buf = ALLOCA_N(char, strlen(cname) + 4);
|
||||
VALUE str = rb_str_new(0, strlen(cname) + 4);
|
||||
|
||||
sprintf(buf, "#<%s>", cname);
|
||||
return rb_str_new2(buf);
|
||||
sprintf(RSTRING(str)->ptr, "#<%s>", cname);
|
||||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -386,10 +386,10 @@ rb_struct_inspect(s)
|
|||
{
|
||||
if (rb_inspecting_p(s)) {
|
||||
char *cname = rb_class2name(CLASS_OF(s));
|
||||
char *buf = ALLOCA_N(char, strlen(cname) + 8);
|
||||
VALUE str = rb_str_new(0, strlen(cname) + 8);
|
||||
|
||||
sprintf(buf, "#<%s:...>", cname);
|
||||
return rb_str_new2(buf);
|
||||
sprintf(RSTRING(str)->ptr, "#<%s:...>", cname);
|
||||
return str;
|
||||
}
|
||||
return rb_protect_inspect(inspect_struct, s, 0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.6.1"
|
||||
#define RUBY_RELEASE_DATE "2000-10-05"
|
||||
#define RUBY_VERSION_CODE 161
|
||||
#define RUBY_RELEASE_CODE 20001005
|
||||
#define RUBY_VERSION "1.6.2"
|
||||
#define RUBY_RELEASE_DATE "2000-10-08"
|
||||
#define RUBY_VERSION_CODE 162
|
||||
#define RUBY_RELEASE_CODE 20001008
|
||||
|
|
Loading…
Add table
Reference in a new issue