guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-125-g587f4


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-125-g587f4ed
Date: Mon, 25 Feb 2013 18:56:06 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=587f4edd3947880fb0235f84cc18b62f133a9255

The branch, stable-2.0 has been updated
       via  587f4edd3947880fb0235f84cc18b62f133a9255 (commit)
       via  3ec19a7884ba789a9b4f91f61415aa4b84642690 (commit)
       via  444b26f739d88ab410d561f1abda67b3d6c0f491 (commit)
      from  08904661a2b1c6d461b2f5abfe3226a4023453fb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 587f4edd3947880fb0235f84cc18b62f133a9255
Author: Mark H Weaver <address@hidden>
Date:   Mon Feb 25 13:38:55 2013 -0500

    random_state_of_last_resort: use getpid directly, instead of scm_getpid
    
    * libguile/random.c: Include <sys/types.h> and <unistd.h> (if present).
      (random_state_of_last_resort): Use getpid directly.

commit 3ec19a7884ba789a9b4f91f61415aa4b84642690
Author: Mark H Weaver <address@hidden>
Date:   Mon Feb 25 13:33:28 2013 -0500

    Revert "random_state_of_last_resort doesn't rely on HAVE_POSIX"
    
    This reverts commit eaf21539d4afb8df5d1b549215fd397b23004947.

commit 444b26f739d88ab410d561f1abda67b3d6c0f491
Author: Mark H Weaver <address@hidden>
Date:   Mon Feb 25 13:33:14 2013 -0500

    Revert "random-state-from-platform: simplify pid conditional, and clarify 
docs."
    
    This reverts commit 08904661a2b1c6d461b2f5abfe3226a4023453fb.

-----------------------------------------------------------------------

Summary of changes:
 doc/ref/api-data.texi |    6 +++---
 libguile/random.c     |   27 ++++++++++++++++-----------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index e17c0c2..9da17d8 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -1872,9 +1872,9 @@ read back with the Scheme reader.
 Construct a new random state seeded from a platform-specific source of
 entropy, appropriate for use in non-security-critical applications.
 Currently @file{/dev/urandom} is tried first, or else the seed is based
-on the time, date, process ID (if scm_getpid is present), an address
-from a freshly allocated heap cell, an address from the local stack
-frame, and a high-resolution timer if available.
+on the time, date, process ID, an address from a freshly allocated heap
+cell, an address from the local stack frame, and a high-resolution timer
+if available.
 @end deffn
 
 @defvar *random-state*
diff --git a/libguile/random.c b/libguile/random.c
index 9cb5e69..f97213b 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001, 2003, 2005, 2006, 2009, 2010, 2013 Free 
Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001, 2003, 2005, 2006, 2009, 2010 Free Software 
Foundation, Inc.
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
  * as published by the Free Software Foundation; either version 3 of
@@ -17,7 +17,7 @@
 
 
 
-/* Author: Mikael Djurfeldt <address@hidden> */
+/* Original Author: Mikael Djurfeldt <address@hidden> */
 
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
@@ -29,6 +29,12 @@
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #include "libguile/smob.h"
 #include "libguile/numbers.h"
 #include "libguile/feature.h"
@@ -653,11 +659,11 @@ SCM_DEFINE (scm_random_exp, "random:exp", 0, 1, 0,
 }
 #undef FUNC_NAME
 
-/* Return a new random-state seeded from the time, date, process ID (if
-   scm_getpid is present), an address from a freshly allocated heap
-   cell, an address from the local stack frame, and a high-resolution
-   timer if available.  This is only to be used as a last resort, when
-   no better source of entropy is available. */
+/* Return a new random-state seeded from the time, date, process ID, an
+   address from a freshly allocated heap cell, an address from the local
+   stack frame, and a high-resolution timer if available.  This is only
+   to be used as a last resort, when no better source of entropy is
+   available. */
 static SCM
 random_state_of_last_resort (void)
 {
@@ -665,17 +671,16 @@ random_state_of_last_resort (void)
   SCM time_of_day = scm_gettimeofday ();
   SCM sources = scm_list_n
     (scm_from_unsigned_integer (SCM_UNPACK (time_of_day)),  /* heap addr */
-#ifdef HAVE_POSIX
-     scm_getpid (),         /* process ID */
-#endif
+     /* Avoid scm_getpid, since it depends on HAVE_POSIX. */
+     scm_from_unsigned_integer (getpid ()),                 /* process ID */
      scm_get_internal_real_time (), /* high-resolution process timer */
      scm_from_unsigned_integer ((scm_t_bits) &time_of_day), /* stack addr */
      scm_car (time_of_day), /* seconds since midnight 1970-01-01 UTC */
      scm_cdr (time_of_day), /* microsecond component of the above clock */
      SCM_UNDEFINED);
-  SCM seed = SCM_INUM0;
 
   /* Concatenate the sources bitwise to form the seed */
+  SCM seed = SCM_INUM0;
   while (scm_is_pair (sources))
     {
       seed = scm_logxor (seed, scm_ash (scm_car (sources),


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]