gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9031 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r9031 - in gnunet/src: include util
Date: Thu, 24 Sep 2009 13:19:28 -0600

Author: durner
Date: 2009-09-24 13:19:28 -0600 (Thu, 24 Sep 2009)
New Revision: 9031

Modified:
   gnunet/src/include/plibc.h
   gnunet/src/util/test_container_bloomfilter.c
Log:
use correct PRNG initializer

Modified: gnunet/src/include/plibc.h
===================================================================
--- gnunet/src/include/plibc.h  2009-09-24 16:34:13 UTC (rev 9030)
+++ gnunet/src/include/plibc.h  2009-09-24 19:19:28 UTC (rev 9031)
@@ -22,7 +22,7 @@
  * @brief PlibC header
  * @attention This file is usually not installed under Unix,
  *            so ship it with your application
- * @version $Revision: 39 $
+ * @version $Revision: 44 $
  */
 
 #ifndef _PLIBC_H_
@@ -379,6 +379,7 @@
 int _win_chmod(const char *filename, int pmode);
 char *realpath(const char *file_name, char *resolved_name);
 long _win_random(void);
+void _win_srandom(unsigned seed);
 int _win_remove(const char *path);
 int _win_rename(const char *oldname, const char *newname);
 int _win_stat(const char *path, struct stat *buffer);
@@ -492,6 +493,7 @@
  #define MUNMAP(s, l) munmap(s, l)
  #define STRERROR(i) strerror(i)
  #define RANDOM() random()
+ #define SRANDOM(s) srandom(s)
  #define READLINK(p, b, s) readlink(p, b, s)
  #define LSTAT(p, b) lstat(p, b)
  #define LSTAT64(p, b) lstat64(p, b)
@@ -570,6 +572,7 @@
  #define CHMOD(f, p) _win_chmod(f, p)
  #define PIPE(h) _win_pipe(h)
  #define RANDOM() _win_random()
+ #define SRANDOM(s) _win_srandom()
  #define REMOVE(p) _win_remove(p)
  #define RENAME(o, n) _win_rename(o, n)
  #define STAT(p, b) _win_stat(p, b)

Modified: gnunet/src/util/test_container_bloomfilter.c
===================================================================
--- gnunet/src/util/test_container_bloomfilter.c        2009-09-24 16:34:13 UTC 
(rev 9030)
+++ gnunet/src/util/test_container_bloomfilter.c        2009-09-24 19:19:28 UTC 
(rev 9031)
@@ -69,7 +69,7 @@
   struct stat sbuf;
 
   GNUNET_log_setup ("test-container-bloomfilter", "WARNING", NULL);
-  srand (1);
+  SRANDOM (1);
   if (0 == stat (TESTFILE, &sbuf))
     if (0 != UNLINK (TESTFILE))
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", TESTFILE);
@@ -80,7 +80,7 @@
       nextHC (&tmp);
       GNUNET_CONTAINER_bloomfilter_add (bf, &tmp);
     }
-  srand (1);
+  SRANDOM (1);
   ok1 = 0;
   for (i = 0; i < 200; i++)
     {
@@ -108,7 +108,7 @@
   bfi = GNUNET_CONTAINER_bloomfilter_init (buf, SIZE, K);
   GNUNET_assert (bfi != NULL);
 
-  srand (1);
+  SRANDOM (1);
   ok1 = 0;
   ok2 = 0;
   for (i = 0; i < 200; i++)
@@ -137,7 +137,7 @@
       return -1;
     }
 
-  srand (1);
+  SRANDOM (1);
   for (i = 0; i < 100; i++)
     {
       nextHC (&tmp);
@@ -145,7 +145,7 @@
       GNUNET_CONTAINER_bloomfilter_remove (bfi, &tmp);
     }
 
-  srand (1);
+  SRANDOM (1);
 
   ok1 = 0;
   ok2 = 0;
@@ -177,7 +177,7 @@
       return -1;
     }
 
-  srand (3);
+  SRANDOM (3);
 
   GNUNET_CONTAINER_bloomfilter_clear (bf);
   falseok = 0;
@@ -201,14 +201,14 @@
       return -1;
     }
 
-  srand (2);
+  SRANDOM (2);
   i = 20;
   GNUNET_CONTAINER_bloomfilter_resize (bfi, &add_iterator, &i, SIZE * 2, K);
 
-  srand (2);
+  SRANDOM (2);
   i = 20;
   GNUNET_CONTAINER_bloomfilter_resize (bf, &add_iterator, &i, SIZE * 2, K);
-  srand (2);
+  SRANDOM (2);
 
   ok1 = 0;
   ok2 = 0;





reply via email to

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