summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-02 08:07:32 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-02 08:07:32 +0000
commit8633eacb30f87eb629fd1fff163cba8c9b70d52e (patch)
treeb0a09302bfb612a10c60ba101386e1c334c7c129
parentfaeed9b54c7b4085d0c6018d27afe5d755a8eb27 (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--ChangeLog28
-rw-r--r--configure.in1
-rw-r--r--file.c22
-rw-r--r--version.h2
4 files changed, 45 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ace068bef8..e1d431b1ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);],
diff --git a/file.c b/file.c
index 6232f7f46e..adc49ef017 100644
--- a/file.c
+++ b/file.c
@@ -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));
diff --git a/version.h b/version.h
index 8dca938e76..cf3804b8b7 100644
--- a/version.h
+++ b/version.h
@@ -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