Don't include <unistd.h> unless HAVE_UNISTD_H. Include <process.h> on
authorTor Lillqvist <tml@iki.fi>
Fri, 23 Jan 2004 02:10:46 +0000 (02:10 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Fri, 23 Jan 2004 02:10:46 +0000 (02:10 +0000)
2004-01-23  Tor Lillqvist  <tml@iki.fi>

* glib/grand.c: Don't include <unistd.h> unless
HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
(g_rand_new): Use getppid() only on G_OS_UNIX.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/grand.c

index 509adb3..00882c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-23  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/grand.c: Don't include <unistd.h> unless
+       HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
+       (g_rand_new): Use getppid() only on G_OS_UNIX.
+
 Thu Jan 22 15:16:11 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.3.2 ===
@@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003  Matthias Clasen  <maclas@gmx.de>
        * configure.in: Don't blindly set glib_cv_long_long_format to
        "ll" when using the included printf. As long as the native 
        printf supports 64bit printing, use the native format.  
-       (#119525, Tor Lillquist)
+       (#119525, Tor Lillqvist)
 
 Fri Nov 14 00:28:46 2003  Matthias Clasen  <maclas@gmx.de>
 
index 509adb3..00882c4 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-23  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/grand.c: Don't include <unistd.h> unless
+       HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
+       (g_rand_new): Use getppid() only on G_OS_UNIX.
+
 Thu Jan 22 15:16:11 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.3.2 ===
@@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003  Matthias Clasen  <maclas@gmx.de>
        * configure.in: Don't blindly set glib_cv_long_long_format to
        "ll" when using the included printf. As long as the native 
        printf supports 64bit printing, use the native format.  
-       (#119525, Tor Lillquist)
+       (#119525, Tor Lillqvist)
 
 Fri Nov 14 00:28:46 2003  Matthias Clasen  <maclas@gmx.de>
 
index 509adb3..00882c4 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-23  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/grand.c: Don't include <unistd.h> unless
+       HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
+       (g_rand_new): Use getppid() only on G_OS_UNIX.
+
 Thu Jan 22 15:16:11 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.3.2 ===
@@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003  Matthias Clasen  <maclas@gmx.de>
        * configure.in: Don't blindly set glib_cv_long_long_format to
        "ll" when using the included printf. As long as the native 
        printf supports 64bit printing, use the native format.  
-       (#119525, Tor Lillquist)
+       (#119525, Tor Lillqvist)
 
 Fri Nov 14 00:28:46 2003  Matthias Clasen  <maclas@gmx.de>
 
index 509adb3..00882c4 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-23  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/grand.c: Don't include <unistd.h> unless
+       HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
+       (g_rand_new): Use getppid() only on G_OS_UNIX.
+
 Thu Jan 22 15:16:11 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.3.2 ===
@@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003  Matthias Clasen  <maclas@gmx.de>
        * configure.in: Don't blindly set glib_cv_long_long_format to
        "ll" when using the included printf. As long as the native 
        printf supports 64bit printing, use the native format.  
-       (#119525, Tor Lillquist)
+       (#119525, Tor Lillqvist)
 
 Fri Nov 14 00:28:46 2003  Matthias Clasen  <maclas@gmx.de>
 
index 509adb3..00882c4 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-23  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/grand.c: Don't include <unistd.h> unless
+       HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
+       (g_rand_new): Use getppid() only on G_OS_UNIX.
+
 Thu Jan 22 15:16:11 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.3.2 ===
@@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003  Matthias Clasen  <maclas@gmx.de>
        * configure.in: Don't blindly set glib_cv_long_long_format to
        "ll" when using the included printf. As long as the native 
        printf supports 64bit printing, use the native format.  
-       (#119525, Tor Lillquist)
+       (#119525, Tor Lillqvist)
 
 Fri Nov 14 00:28:46 2003  Matthias Clasen  <maclas@gmx.de>
 
index 509adb3..00882c4 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-23  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/grand.c: Don't include <unistd.h> unless
+       HAVE_UNISTD_H. Include <process.h> on G_OS_WIN32.
+       (g_rand_new): Use getppid() only on G_OS_UNIX.
+
 Thu Jan 22 15:16:11 2004  Owen Taylor  <otaylor@redhat.com>
 
        * === Released 2.3.2 ===
@@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003  Matthias Clasen  <maclas@gmx.de>
        * configure.in: Don't blindly set glib_cv_long_long_format to
        "ll" when using the included printf. As long as the native 
        printf supports 64bit printing, use the native format.  
-       (#119525, Tor Lillquist)
+       (#119525, Tor Lillqvist)
 
 Fri Nov 14 00:28:46 2003  Matthias Clasen  <maclas@gmx.de>
 
index 98f6b9b..96fc263 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #include "glib.h"
 #include "gthreadinit.h"
 
+#ifdef G_OS_WIN32
+#include <process.h>           /* For getpid() */
+#endif
+
 G_LOCK_DEFINE_STATIC (global_random);
 static GRand* global_random = NULL;
 
@@ -202,7 +208,11 @@ g_rand_new (void)
       seed[0] = now.tv_sec;
       seed[1] = now.tv_usec;
       seed[2] = getpid ();
+#ifdef G_OS_UNIX
       seed[3] = getppid ();
+#else
+      seed[3] = 0;
+#endif
     }
 
   return g_rand_new_with_seed_array (seed, 4);