[前][次][番号順一覧][スレッド一覧]

ruby-changes:27959

From: nobu <ko1@a...>
Date: Sun, 31 Mar 2013 06:08:52 +0900 (JST)
Subject: [ruby-changes:27959] nobu:r40011 (trunk): timev.h: move time_t stuffs

nobu	2013-03-31 06:08:36 +0900 (Sun, 31 Mar 2013)

  New Revision: 40011

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40011

  Log:
    timev.h: move time_t stuffs
    
    * timev.h (TYPEOF_TIMEVAL_TV_SEC, unsigned_time_t): move from time.c.
    
    * thread.c: use definitions in timev.h.

  Modified files:
    trunk/common.mk
    trunk/thread.c
    trunk/thread_pthread.c
    trunk/thread_win32.c
    trunk/time.c
    trunk/timev.h

Index: thread_win32.c
===================================================================
--- thread_win32.c	(revision 40010)
+++ thread_win32.c	(revision 40011)
@@ -506,16 +506,6 @@ native_cond_timedwait(rb_thread_cond_t * https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L506
     return native_cond_timedwait_ms(cond, mutex, timeout_ms);
 }
 
-#if SIZEOF_TIME_T == SIZEOF_LONG
-typedef unsigned long unsigned_time_t;
-#elif SIZEOF_TIME_T == SIZEOF_INT
-typedef unsigned int unsigned_time_t;
-#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
-typedef unsigned LONG_LONG unsigned_time_t;
-#else
-# error cannot find integer type which size is same as time_t.
-#endif
-
 static struct timespec
 native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel)
 {
Index: time.c
===================================================================
--- time.c	(revision 40010)
+++ time.c	(revision 40011)
@@ -717,27 +717,6 @@ num_exact(VALUE v) https://github.com/ruby/ruby/blob/trunk/time.c#L717
 
 /* time_t */
 
-#ifndef TYPEOF_TIMEVAL_TV_SEC
-# define TYPEOF_TIMEVAL_TV_SEC time_t
-#endif
-#ifndef TYPEOF_TIMEVAL_TV_USEC
-# if INT_MAX >= 1000000
-# define TYPEOF_TIMEVAL_TV_USEC int
-# else
-# define TYPEOF_TIMEVAL_TV_USEC long
-# endif
-#endif
-
-#if SIZEOF_TIME_T == SIZEOF_LONG
-typedef unsigned long unsigned_time_t;
-#elif SIZEOF_TIME_T == SIZEOF_INT
-typedef unsigned int unsigned_time_t;
-#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
-typedef unsigned LONG_LONG unsigned_time_t;
-#else
-# error cannot find integer type which size is same as time_t.
-#endif
-
 static wideval_t
 rb_time_magnify(wideval_t w)
 {
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 40010)
+++ thread_pthread.c	(revision 40011)
@@ -363,16 +363,6 @@ native_cond_timedwait(rb_thread_cond_t * https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L363
     return r;
 }
 
-#if SIZEOF_TIME_T == SIZEOF_LONG
-typedef unsigned long unsigned_time_t;
-#elif SIZEOF_TIME_T == SIZEOF_INT
-typedef unsigned int unsigned_time_t;
-#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
-typedef unsigned LONG_LONG unsigned_time_t;
-#else
-# error cannot find integer type which size is same as time_t.
-#endif
-
 static struct timespec
 native_cond_timeout(rb_thread_cond_t *cond, struct timespec timeout_rel)
 {
Index: thread.c
===================================================================
--- thread.c	(revision 40010)
+++ thread.c	(revision 40011)
@@ -60,6 +60,7 @@ https://github.com/ruby/ruby/blob/trunk/thread.c#L60
 #include "eval_intern.h"
 #include "gc.h"
 #include "internal.h"
+#include "timev.h"
 #include "ruby/io.h"
 #include "ruby/thread.h"
 
Index: common.mk
===================================================================
--- common.mk	(revision 40010)
+++ common.mk	(revision 40011)
@@ -745,7 +745,7 @@ struct.$(OBJEXT): {$(VPATH)}struct.c $(R https://github.com/ruby/ruby/blob/trunk/common.mk#L745
 thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
   $(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
   {$(VPATH)}thread_$(THREAD_MODEL).c $(ENCODING_H_INCLUDES) \
-  {$(VPATH)}internal.h {$(VPATH)}io.h {$(VPATH)}thread.h
+  {$(VPATH)}internal.h {$(VPATH)}io.h {$(VPATH)}thread.h {$(VPATH)}timev.h
 transcode.$(OBJEXT): {$(VPATH)}transcode.c $(RUBY_H_INCLUDES) \
   $(ENCODING_H_INCLUDES) {$(VPATH)}transcode_data.h {$(VPATH)}internal.h
 cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) \
Index: timev.h
===================================================================
--- timev.h	(revision 40010)
+++ timev.h	(revision 40011)
@@ -18,4 +18,25 @@ struct vtm { https://github.com/ruby/ruby/blob/trunk/timev.h#L18
 
 #define TIME_SCALE 1000000000
 
+#ifndef TYPEOF_TIMEVAL_TV_SEC
+# define TYPEOF_TIMEVAL_TV_SEC time_t
+#endif
+#ifndef TYPEOF_TIMEVAL_TV_USEC
+# if INT_MAX >= 1000000
+# define TYPEOF_TIMEVAL_TV_USEC int
+# else
+# define TYPEOF_TIMEVAL_TV_USEC long
+# endif
+#endif
+
+#if SIZEOF_TIME_T == SIZEOF_LONG
+typedef unsigned long unsigned_time_t;
+#elif SIZEOF_TIME_T == SIZEOF_INT
+typedef unsigned int unsigned_time_t;
+#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
+typedef unsigned LONG_LONG unsigned_time_t;
+#else
+# error cannot find integer type which size is same as time_t.
+#endif
+
 #endif

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]