1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* configure.in (dev_t): use RUBY_REPLACE_TYPE.

* file.c (rb_stat_inspect): use PRI_DEVT_PREFIX.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-10-15 11:30:33 +00:00
parent 8a0cd16de1
commit a45936d454
3 changed files with 9 additions and 11 deletions

View file

@ -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

View file

@ -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);],

12
file.c
View file

@ -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));