summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--configure.in2
-rw-r--r--file.c12
3 files changed, 9 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 1744a5b45e..cfe3d5e982 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
Fri Oct 15 17:26:57 2010 NARUSE, Yui <naruse@ruby-lang.org>
* pack.c (pack_pack): simplify comparison of explicit_endian
diff --git a/configure.in b/configure.in
index 74a32715e2..bc7f98f55c 100644
--- a/configure.in
+++ b/configure.in
@@ -576,7 +576,6 @@ RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP])
RUBY_CHECK_SIZEOF(float)
RUBY_CHECK_SIZEOF(double)
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
-RUBY_CHECK_SIZEOF(dev_t, [int long "long long"])
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
@@ -625,6 +624,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 33425faae1..fb748d91d5 100644
--- a/file.c
+++ b/file.c
@@ -316,14 +316,6 @@ rb_stat_cmp(VALUE self, VALUE other)
#define ST2UINT(val) ((val) & ~(~1UL << (sizeof(val) * CHAR_BIT - 1)))
-#if SIZEOF_DEV_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
-# define DEVT2NUM(v) ULL2NUM(v)
-#elif SIZEOF_DEV_T == SIZEOF_LONG
-# define DEVT2NUM(v) ULONG2NUM(v)
-#else
-# define DEVT2NUM(v) UINT2NUM(v)
-#endif
-
/*
* call-seq:
* stat.dev -> fixnum
@@ -779,10 +771,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));