mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (rb_stat_clone): should copy internal data too.
* numeric.c (num_clone): Numeric should not be copied by clone. * object.c (rb_obj_clone): should check immediate values. * parse.y (command): `yield' should take command_args. * parse.y (parse_quotedwords): %w(...) is not a string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
14129c8fa3
commit
8098dd6c80
7 changed files with 51 additions and 7 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Wed Oct 10 03:11:47 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* file.c (rb_stat_clone): should copy internal data too.
|
||||
|
||||
* numeric.c (num_clone): Numeric should not be copied by clone.
|
||||
|
||||
* object.c (rb_obj_clone): should check immediate values.
|
||||
|
||||
* parse.y (command): `yield' should take command_args.
|
||||
|
||||
* parse.y (parse_quotedwords): %w(...) is not a string.
|
||||
|
||||
Tue Oct 9 18:40:35 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* process.c (Init_process): activate the case NT.
|
||||
|
|
2
eval.c
2
eval.c
|
@ -5232,7 +5232,7 @@ rb_obj_instance_eval(argc, argv, self)
|
|||
return specific_eval(argc, argv, klass, self);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
VALUE
|
||||
rb_mod_module_eval(argc, argv, mod)
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
|
|
24
file.c
24
file.c
|
@ -395,7 +395,11 @@ group_member(gid)
|
|||
|
||||
# ifdef HAVE_GETGROUPS
|
||||
# ifndef NGROUPS
|
||||
# ifdef NGROUPS_MAX
|
||||
# define NGROUPS NGROUPS_MAX
|
||||
# else
|
||||
# define NGROUPS 32
|
||||
# endif
|
||||
# endif
|
||||
{
|
||||
GETGROUPS_T gary[NGROUPS];
|
||||
|
@ -1908,6 +1912,25 @@ rb_stat_init(obj, fname)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_clone(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
struct stat st, *nst;
|
||||
|
||||
VALUE clone;
|
||||
|
||||
clone = rb_obj_alloc(RBASIC(obj)->klass);
|
||||
CLONESETUP(clone,obj);
|
||||
if (DATA_PTR(obj)) {
|
||||
nst = ALLOC(struct stat);
|
||||
*nst = *(struct stat*)DATA_PTR(obj);
|
||||
DATA_PTR(clone) = nst;
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_stat_ftype(obj)
|
||||
VALUE obj;
|
||||
|
@ -2509,6 +2532,7 @@ Init_File()
|
|||
rb_cStat = rb_define_class_under(rb_cFile, "Stat", rb_cObject);
|
||||
rb_define_singleton_method(rb_cStat, "allocate", rb_stat_s_alloc, 0);
|
||||
rb_define_method(rb_cStat, "initialize", rb_stat_init, 1);
|
||||
rb_define_method(rb_cStat, "clone", rb_stat_clone, 0);
|
||||
|
||||
rb_include_module(rb_cStat, rb_mComparable);
|
||||
|
||||
|
|
1
intern.h
1
intern.h
|
@ -141,6 +141,7 @@ VALUE rb_apply _((VALUE, ID, VALUE));
|
|||
void rb_backtrace _((void));
|
||||
ID rb_frame_last_func _((void));
|
||||
VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
|
||||
VALUE rb_mod_module_eval _((int, VALUE*, VALUE));
|
||||
void rb_load _((VALUE, int));
|
||||
void rb_load_protect _((VALUE, int, int*));
|
||||
NORETURN(void rb_jump_tag _((int)));
|
||||
|
|
|
@ -91,8 +91,9 @@ static VALUE
|
|||
num_clone(x)
|
||||
VALUE x;
|
||||
{
|
||||
/* Numerics are immutable values, which need not to copy */
|
||||
return x;
|
||||
/* Numerics are immutable values, which should not be copied */
|
||||
rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(x)));
|
||||
return Qnil; /* not reached */
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
7
object.c
7
object.c
|
@ -94,6 +94,9 @@ rb_obj_clone(obj)
|
|||
{
|
||||
VALUE clone;
|
||||
|
||||
if (rb_special_const_p(obj)) {
|
||||
rb_raise(rb_eTypeError, "can't clone %s", rb_class2name(CLASS_OF(obj)));
|
||||
}
|
||||
clone = rb_obj_alloc(RBASIC(obj)->klass);
|
||||
CLONESETUP(clone,obj);
|
||||
if (TYPE(clone) == T_OBJECT && ROBJECT(obj)->iv_tbl) {
|
||||
|
@ -587,10 +590,12 @@ rb_mod_cmp(mod, arg)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
rb_mod_initialize(argc, argv)
|
||||
rb_mod_initialize(argc, argv, module)
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
VALUE module;
|
||||
{
|
||||
rb_mod_module_eval(0, 0, module);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
7
parse.y
7
parse.y
|
@ -208,7 +208,7 @@ static void top_local_setup();
|
|||
|
||||
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR
|
||||
%token <val> tINTEGER tFLOAT tSTRING tXSTRING tREGEXP
|
||||
%token <node> tDSTRING tDXSTRING tDREGEXP tNTH_REF tBACK_REF
|
||||
%token <node> tDSTRING tDXSTRING tDREGEXP tNTH_REF tBACK_REF tQWORDS
|
||||
|
||||
%type <node> singleton string
|
||||
%type <val> literal numeric
|
||||
|
@ -510,7 +510,7 @@ command : operation command_args
|
|||
$$ = new_super($2);
|
||||
fixpos($$, $2);
|
||||
}
|
||||
| kYIELD call_args
|
||||
| kYIELD command_args
|
||||
{
|
||||
$$ = NEW_YIELD(ret_args($2));
|
||||
fixpos($$, $2);
|
||||
|
@ -1163,6 +1163,7 @@ primary : literal
|
|||
{
|
||||
$$ = NEW_XSTR($1);
|
||||
}
|
||||
| tQWORDS
|
||||
| tDXSTRING
|
||||
| tDREGEXP
|
||||
| var_ref
|
||||
|
@ -2742,7 +2743,7 @@ parse_quotedwords(term, paren)
|
|||
if (!qwords) qwords = NEW_ZARRAY();
|
||||
yylval.node = qwords;
|
||||
lex_state = EXPR_END;
|
||||
return tDSTRING;
|
||||
return tQWORDS;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in a new issue