From: Florian Frank Date: 2002-08-03T22:01:54+09:00 Subject: --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="file.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 } --AhhlLboLdkugWU4S--