[Reorder] struct timeval diversion
From:
Michal Rokos <m.rokos@...>
Date:
2002-09-13 14:30:53 UTC
List:
ruby-core #488
Hi,
because struct timeval is not defined on some platforms, it has
been defined in Ruby, but
unfortunately various C-sources has different definitions.
Because I think it's good to have things coherent, I moved
definition to missing.h.
I hope you'll like it.
Michal
Index: missing.h
===================================================================
RCS file: /src/ruby/missing.h,v
retrieving revision 1.2
diff -u -p -r1.2 missing.h
--- missing.h 2002/05/14 06:22:26 1.2
+++ missing.h 2002/09/13 14:24:06
@@ -1,6 +1,7 @@
/************************************************
- missing.h - prototype for *.c in ./missing
+ missing.h - prototype for *.c in ./missing, and
+ for missing timeval struct
$Author: matz $
$Date: 2002/05/14 06:22:26 $
@@ -10,6 +11,16 @@
#ifndef MISSING_H
#define MISSING_H
+
+#if defined(HAVE_SYS_TIME_H)
+# include <sys/time.h>
+#elif !defined(NT)
+# define time_t long
+struct timeval {
+ time_t tv_sec; /* seconds */
+ time_t tv_usec; /* microseconds */
+};
+#endif
#ifndef HAVE_ACOSH
extern double acosh _((double));
Index: eval.c
===================================================================
RCS file: /src/ruby/eval.c,v
retrieving revision 1.328
diff -u -p -r1.328 eval.c
--- eval.c 2002/09/13 09:36:28 1.328
+++ eval.c 2002/09/13 14:24:04
@@ -74,16 +74,6 @@ char *strrchr _((const char*,const char)
#endif
#include <sys/types.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#else
-#ifndef NT
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif /* NT */
-#endif
#include <signal.h>
#include <errno.h>
Index: io.c
===================================================================
RCS file: /src/ruby/io.c,v
retrieving revision 1.157
diff -u -p -r1.157 io.c
--- io.c 2002/09/11 01:09:04 1.157
+++ io.c 2002/09/13 14:24:06
@@ -60,17 +60,6 @@
# define ftello ftell
#endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#else
-#ifndef NT
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif
-#endif
-
#include <sys/stat.h>
/* EMX has sys/param.h, but.. */
Index: process.c
===================================================================
RCS file: /src/ruby/process.c,v
retrieving revision 1.55
diff -u -p -r1.55 process.c
--- process.c 2002/08/28 08:05:23 1.55
+++ process.c 2002/09/13 14:24:08
@@ -22,16 +22,6 @@
#endif
#include <time.h>
-#ifndef NT
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#else
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif
-#endif /* NT */
#include <ctype.h>
struct timeval rb_time_interval _((VALUE));
Index: random.c
===================================================================
RCS file: /src/ruby/random.c,v
retrieving revision 1.24
diff -u -p -r1.24 random.c
--- random.c 2002/08/21 15:47:54 1.24
+++ random.c 2002/09/13 14:24:08
@@ -144,16 +144,6 @@ genrand_real()
#include <unistd.h>
#endif
#include <time.h>
-#ifndef NT
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#else
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-#endif
-#endif /* NT */
static int first = 1;
Index: time.c
===================================================================
RCS file: /src/ruby/time.c,v
retrieving revision 1.68
diff -u -p -r1.68 time.c
--- time.c 2002/09/08 12:59:07 1.68
+++ time.c 2002/09/13 14:24:09
@@ -12,23 +12,12 @@
#include "ruby.h"
#include <sys/types.h>
-
#include <time.h>
-#ifndef NT
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#else
-#define time_t long
-struct timeval {
- time_t tv_sec; /* seconds */
- time_t tv_usec; /* and microseconds */
-};
-#endif
-#endif /* NT */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+
#include <math.h>
VALUE rb_cTime;
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michal Rokos Czech Technical University, Prague
e-mail: m.rokos@sh.cvut.cz icq: 36118339 jabber: majkl@jabber.cz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-