diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:07:32 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:07:32 +0000 |
commit | 8633eacb30f87eb629fd1fff163cba8c9b70d52e (patch) | |
tree | b0a09302bfb612a10c60ba101386e1c334c7c129 | |
parent | faeed9b54c7b4085d0c6018d27afe5d755a8eb27 (diff) |
merges r29493,r29494,r29505 and r29509 from trunk into ruby_1_9_2.
--
* file.c (DEVT2NUM): added. Size of dev_t is depend on the
environment even if POSIX defines dev_t as unsigned integer.
For example, OpenVMS, 64bit Solaris 9, and NetBSD 6 defines
dev_t as 64bit unsigned integer.
* file.c (rb_stat_dev): use DEVT2NUM.
* file.c (rb_stat_dev_major): dev_t is not long. major(3)'s return
value is int.
* file.c (rb_stat_dev_minor): dev_t is not long. minor(3)'s return
value is int.
* configure.in: check size of dev_t.
--
Refix for r29493; it is unsigned.
--
* configure.in (dev_t): use RUBY_REPLACE_TYPE.
* file.c (rb_stat_inspect): use PRI_DEVT_PREFIX.
--
* file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to
unsigned int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 28 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | file.c | 22 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 45 insertions, 8 deletions
@@ -1,3 +1,31 @@ +Fri Oct 15 23:36:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * file.c (NUM2DEVT, DEVT2NUM, PRI_DEVT_PREFIX): fallback to + unsigned int. + +Fri Oct 15 20:30:30 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * configure.in (dev_t): use RUBY_REPLACE_TYPE. + + * file.c (rb_stat_inspect): use PRI_DEVT_PREFIX. + +Thu Oct 14 07:35:07 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * file.c (DEVT2NUM): added. Size of dev_t is depend on the + environment even if POSIX defines dev_t as unsigned integer. + For example, OpenVMS, 64bit Solaris 9, and NetBSD 6 defines + dev_t as 64bit unsigned integer. + + * file.c (rb_stat_dev): use DEVT2NUM. + + * file.c (rb_stat_dev_major): dev_t is not long. major(3)'s return + value is int. + + * file.c (rb_stat_dev_minor): dev_t is not long. minor(3)'s return + value is int. + + * configure.in: check size of dev_t. + Thu Oct 14 20:50:51 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp> * ext/win32ole/win32ole.c (reg_get_val): expand environment in diff --git a/configure.in b/configure.in index 3cb0ced3b5..c896ed0003 100644 --- a/configure.in +++ b/configure.in @@ -593,6 +593,7 @@ RUBY_REPLACE_TYPE(pid_t, int, PIDT) RUBY_REPLACE_TYPE(uid_t, int, UIDT) RUBY_REPLACE_TYPE(gid_t, int, GIDT) RUBY_REPLACE_TYPE(time_t, [], TIMET, [@%:@include <time.h>]) +RUBY_REPLACE_TYPE(dev_t, [int long "long long"], DEVT) AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes, [AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], @@ -311,6 +311,16 @@ rb_stat_cmp(VALUE self, VALUE other) #define ST2UINT(val) ((val) & ~(~1UL << (sizeof(val) * CHAR_BIT - 1))) +#ifndef NUM2DEVT +# define NUM2DEVT(v) NUM2UINT(v) +#endif +#ifndef DEVT2NUM +# define DEVT2NUM(v) UINT2NUM(v) +#endif +#ifndef PRI_DEVT_PREFIX +# define PRI_DEVT_PREFIX "" +#endif + /* * call-seq: * stat.dev -> fixnum @@ -324,7 +334,7 @@ rb_stat_cmp(VALUE self, VALUE other) static VALUE rb_stat_dev(VALUE self) { - return INT2NUM(get_stat(self)->st_dev); + return DEVT2NUM(get_stat(self)->st_dev); } /* @@ -342,8 +352,7 @@ static VALUE rb_stat_dev_major(VALUE self) { #if defined(major) - long dev = get_stat(self)->st_dev; - return ULONG2NUM(major(dev)); + return INT2NUM(major(get_stat(self)->st_dev)); #else return Qnil; #endif @@ -364,8 +373,7 @@ static VALUE rb_stat_dev_minor(VALUE self) { #if defined(minor) - long dev = get_stat(self)->st_dev; - return ULONG2NUM(minor(dev)); + return INT2NUM(minor(get_stat(self)->st_dev)); #else return Qnil; #endif @@ -768,10 +776,10 @@ rb_stat_inspect(VALUE self) rb_str_buf_cat2(str, "="); v = (*member[i].func)(self); if (i == 2) { /* mode */ - rb_str_catf(str, "0%lo", NUM2ULONG(v)); + rb_str_catf(str, "0%lo", (unsigned long)NUM2ULONG(v)); } else if (i == 0 || i == 6) { /* dev/rdev */ - rb_str_catf(str, "0x%lx", NUM2ULONG(v)); + rb_str_catf(str, "0x%"PRI_DEVT_PREFIX"x", NUM2DEVT(v)); } else { rb_str_append(str, rb_inspect(v)); @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 77 +#define RUBY_PATCHLEVEL 78 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |