summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-19 09:09:38 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-19 09:09:38 +0000
commita070c4fbe3cff184d224d1abb8a3101e3c11fc48 (patch)
tree954403e1c09aa8f83d1f153de42e9b7d24f4f289 /marshal.c
parenta2946d85ec24abd6693a366b78f19cb03acf81b2 (diff)
* configure.in: check struct timespec, clock_gettime, utimensat,
struct stat.st_atim, struct stat.st_atimespec, struct stat.st_atimensec, struct stat.st_mtim, struct stat.st_mtimespec, struct stat.st_mtimensec, struct stat.st_ctim, struct stat.st_ctimespec, struct stat.st_ctimensec. * include/ruby/missing.h: provide struct timespec if not available. * time.c: support nanosecond-resolution using struct timespec. * include/ruby/intern.h: provide rb_time_nano_new. * file.c (utime_internal): use utimensat if available. (rb_file_s_utime): refactored. (rb_f_test): use stat_atime, stat_mtime, stat_ctime. (rb_stat_cmp): check tv_nsec. (stat_atimespec): new function. (stat_atime): ditto. (stat_mtimespec): ditto. (stat_mtime): ditto. (stat_ctimespec): ditto. (stat_ctime): ditto. (rb_stat_atime): use stat_atime. (rb_file_s_atime): ditto. (rb_file_atime): ditto. (rb_stat_mtime): use stat_mtime. (rb_file_s_mtime): ditto. (rb_file_mtime): ditto. (rb_file_ctime): use stat_ctime. (rb_file_s_ctime): ditto. (rb_stat_ctime): ditto. * variable.c (rb_copy_generic_ivar): clear clone's instance variables if obj has no instance variable. * marshal.c (w_object): dump instance variables of generated string for TYPE_USERDEF, even if original object has instance variables. * lib/time.rb (Time#xmlschema): use nsec instead of usec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index 23669b9290..e28a215a8b 100644
--- a/marshal.c
+++ b/marshal.c
@@ -601,17 +601,22 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
}
if (rb_respond_to(obj, s_dump)) {
VALUE v;
+ st_table *ivtbl2 = 0;
+ int hasiv2;
v = rb_funcall(obj, s_dump, 1, INT2NUM(limit));
if (TYPE(v) != T_STRING) {
rb_raise(rb_eTypeError, "_dump() must return string");
}
- if (!hasiv && (hasiv = has_ivars(v, ivtbl)) != 0) {
+ if ((hasiv2 = has_ivars(v, ivtbl2)) != 0 && !hasiv) {
w_byte(TYPE_IVAR, arg);
}
w_class(TYPE_USERDEF, obj, arg, Qfalse);
w_bytes(RSTRING_PTR(v), RSTRING_LEN(v), arg);
- if (hasiv) {
+ if (hasiv2) {
+ w_ivar(obj, ivtbl2, &c_arg);
+ }
+ else if (hasiv) {
w_ivar(obj, ivtbl, &c_arg);
}
return;