[#290] — Florian Frank <flori@...>
Hi all,
5 messages
2002/08/03
[#297] GC longjmp macros — Michal Rokos <m.rokos@...>
Hi,
5 messages
2002/08/05
[#308] Q: OSSL in std. distr? — Michal Rokos <m.rokos@...>
Hi,
4 messages
2002/08/08
[#326] Implications of a #force_free method in Object? — Matthew Bloch <mattbee@...>
Hello;
8 messages
2002/08/19
[#328] Int vs Long — Michal Rokos <m.rokos@...>
Hi,
7 messages
2002/08/21
[#337] Int vs Long (2nd part) — Michal Rokos <m.rokos@...>
Hi,
7 messages
2002/08/22
[#340] Int vs Long #3 — Michal Rokos <m.rokos@...>
Hi,
9 messages
2002/08/22
[#344] Re: [Cleanup] Int vs Long #3
— nobu.nokada@...
2002/08/22
Hi,
[#348] Re: [Cleanup] Int vs Long #3
— Michal Rokos <m.rokos@...>
2002/08/23
Hello,
[#353] File (struct stat handling) — Michal Rokos <m.rokos@...>
Hello,
6 messages
2002/08/23
[#358] node.h for eval.c — Michal Rokos <m.rokos@...>
Hi,
5 messages
2002/08/23
[#372] rb_class_path — Michal Rokos <m.rokos@...>
Hello,
7 messages
2002/08/27
[#382] Port match to new dup, clone framework — Michal Rokos <m.rokos@...>
Hi,
5 messages
2002/08/28
[#393] in dln.c — Michal Rokos <m.rokos@...>
Hi,
14 messages
2002/08/30
[#398] Re: [MemLeak] in dln.c
— nobu.nokada@...
2002/08/31
Hi,
[#403] Re: [MemLeak] in dln.c
— Michal Rokos <m.rokos@...>
2002/09/02
Hello,
From:
Florian Frank <flori@...>
Date:
2002-08-03 13:01:54 UTC
List:
ruby-core #290
Hi all, some methods of File::Stat return 0 if the underlying feature isn't supported on the target platform. Wouldn't it be nice if they returned nil? With nil it would be possible to use the idiomatic size = stat.blksize || 4096 to give a default value without first checking if blksize is 0. This would avert the danger to use the 0 values and overlook the fact that they don't make any sense on those platforms as well. I have attached a patch to be applied if you consider this changes ok. -- WAR IS PEACE FREEDOM IS SLAVERY IGNORANCE IS STRENGTH. -- George Orwell, "1984", 1948
Attachments (1)
file.diff
(1.1 KB, text/x-diff)
Index: file.c
===================================================================
RCS file: /src/ruby/file.c,v
retrieving revision 1.102
diff -u -p -u -r1.102 file.c
--- file.c 2002/06/11 01:27:46 1.102
+++ file.c 2002/08/03 00:31:13
@@ -214,7 +214,7 @@ rb_stat_rdev(self)
#ifdef HAVE_ST_RDEV
return ULONG2NUM(get_stat(self)->st_rdev);
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -226,7 +226,7 @@ rb_stat_rdev_major(self)
long rdev = get_stat(self)->st_rdev;
return ULONG2NUM(major(rdev));
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -238,7 +238,7 @@ rb_stat_rdev_minor(self)
long rdev = get_stat(self)->st_rdev;
return ULONG2NUM(minor(rdev));
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -256,7 +256,7 @@ rb_stat_blksize(self)
#ifdef HAVE_ST_BLKSIZE
return ULONG2NUM(get_stat(self)->st_blksize);
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}
@@ -267,7 +267,7 @@ rb_stat_blocks(self)
#ifdef HAVE_ST_BLOCKS
return ULONG2NUM(get_stat(self)->st_blocks);
#else
- return INT2FIX(0);
+ return Qnil;
#endif
}