summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-10 08:21:13 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-10 08:21:13 +0000
commit8098dd6c802db53a0e879efb7e48e75981f043d3 (patch)
tree96377ab531ba1336b6b63a5e2eb6382456312bcb /file.c
parent14129c8fa30055b25036e490c0b8d87ffcfa34b2 (diff)
* 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
Diffstat (limited to 'file.c')
-rw-r--r--file.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/file.c b/file.c
index e9c4edc..c5d41d2 100644
--- a/file.c
+++ b/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];
@@ -1909,6 +1913,25 @@ rb_stat_init(obj, fname)
}
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);