From 876b7efdbd3f40757f16b6ad9dbc9719b7646e72 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 23 Jan 2004 02:10:46 +0000 Subject: [PATCH] Don't include unless HAVE_UNISTD_H. Include on 2004-01-23 Tor Lillqvist * glib/grand.c: Don't include unless HAVE_UNISTD_H. Include on G_OS_WIN32. (g_rand_new): Use getppid() only on G_OS_UNIX. --- ChangeLog | 8 +++++++- ChangeLog.pre-2-10 | 8 +++++++- ChangeLog.pre-2-12 | 8 +++++++- ChangeLog.pre-2-4 | 8 +++++++- ChangeLog.pre-2-6 | 8 +++++++- ChangeLog.pre-2-8 | 8 +++++++- glib/grand.c | 10 ++++++++++ 7 files changed, 52 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 509adb3..00882c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-01-23 Tor Lillqvist + + * glib/grand.c: Don't include unless + HAVE_UNISTD_H. Include on G_OS_WIN32. + (g_rand_new): Use getppid() only on G_OS_UNIX. + Thu Jan 22 15:16:11 2004 Owen Taylor * === Released 2.3.2 === @@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen * 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 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 509adb3..00882c4 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2004-01-23 Tor Lillqvist + + * glib/grand.c: Don't include unless + HAVE_UNISTD_H. Include on G_OS_WIN32. + (g_rand_new): Use getppid() only on G_OS_UNIX. + Thu Jan 22 15:16:11 2004 Owen Taylor * === Released 2.3.2 === @@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen * 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 diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 509adb3..00882c4 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,9 @@ +2004-01-23 Tor Lillqvist + + * glib/grand.c: Don't include unless + HAVE_UNISTD_H. Include on G_OS_WIN32. + (g_rand_new): Use getppid() only on G_OS_UNIX. + Thu Jan 22 15:16:11 2004 Owen Taylor * === Released 2.3.2 === @@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen * 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 diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 509adb3..00882c4 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2004-01-23 Tor Lillqvist + + * glib/grand.c: Don't include unless + HAVE_UNISTD_H. Include on G_OS_WIN32. + (g_rand_new): Use getppid() only on G_OS_UNIX. + Thu Jan 22 15:16:11 2004 Owen Taylor * === Released 2.3.2 === @@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen * 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 diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 509adb3..00882c4 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2004-01-23 Tor Lillqvist + + * glib/grand.c: Don't include unless + HAVE_UNISTD_H. Include on G_OS_WIN32. + (g_rand_new): Use getppid() only on G_OS_UNIX. + Thu Jan 22 15:16:11 2004 Owen Taylor * === Released 2.3.2 === @@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen * 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 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 509adb3..00882c4 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2004-01-23 Tor Lillqvist + + * glib/grand.c: Don't include unless + HAVE_UNISTD_H. Include on G_OS_WIN32. + (g_rand_new): Use getppid() only on G_OS_UNIX. + Thu Jan 22 15:16:11 2004 Owen Taylor * === Released 2.3.2 === @@ -215,7 +221,7 @@ Sat Nov 15 00:46:14 2003 Matthias Clasen * 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 diff --git a/glib/grand.c b/glib/grand.c index 98f6b9b..96fc263 100644 --- a/glib/grand.c +++ b/glib/grand.c @@ -43,11 +43,17 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include "glib.h" #include "gthreadinit.h" +#ifdef G_OS_WIN32 +#include /* 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); -- 2.7.4