aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNils Durner <durner@gnunet.org>2009-09-24 19:19:28 +0000
committerNils Durner <durner@gnunet.org>2009-09-24 19:19:28 +0000
commit76c024311489ede1bca79cf647e568dde70d8a48 (patch)
tree98a71198d2a7d389b0f193144b04d3008b10cc68 /src
parent01abf4826614131fe2eb9a0c1a968bc61e5775be (diff)
downloadgnunet-76c024311489ede1bca79cf647e568dde70d8a48.tar.gz
gnunet-76c024311489ede1bca79cf647e568dde70d8a48.zip
use correct PRNG initializer
Diffstat (limited to 'src')
-rw-r--r--src/include/plibc.h5
-rw-r--r--src/util/test_container_bloomfilter.c18
2 files changed, 13 insertions, 10 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h
index 51d78fc7e..6d02323aa 100644
--- a/src/include/plibc.h
+++ b/src/include/plibc.h
@@ -22,7 +22,7 @@
22 * @brief PlibC header 22 * @brief PlibC header
23 * @attention This file is usually not installed under Unix, 23 * @attention This file is usually not installed under Unix,
24 * so ship it with your application 24 * so ship it with your application
25 * @version $Revision: 39 $ 25 * @version $Revision: 44 $
26 */ 26 */
27 27
28#ifndef _PLIBC_H_ 28#ifndef _PLIBC_H_
@@ -379,6 +379,7 @@ int _win_access( const char *path, int mode );
379int _win_chmod(const char *filename, int pmode); 379int _win_chmod(const char *filename, int pmode);
380char *realpath(const char *file_name, char *resolved_name); 380char *realpath(const char *file_name, char *resolved_name);
381long _win_random(void); 381long _win_random(void);
382void _win_srandom(unsigned seed);
382int _win_remove(const char *path); 383int _win_remove(const char *path);
383int _win_rename(const char *oldname, const char *newname); 384int _win_rename(const char *oldname, const char *newname);
384int _win_stat(const char *path, struct stat *buffer); 385int _win_stat(const char *path, struct stat *buffer);
@@ -492,6 +493,7 @@ size_t strnlen (const char *str, size_t maxlen);
492 #define MUNMAP(s, l) munmap(s, l) 493 #define MUNMAP(s, l) munmap(s, l)
493 #define STRERROR(i) strerror(i) 494 #define STRERROR(i) strerror(i)
494 #define RANDOM() random() 495 #define RANDOM() random()
496 #define SRANDOM(s) srandom(s)
495 #define READLINK(p, b, s) readlink(p, b, s) 497 #define READLINK(p, b, s) readlink(p, b, s)
496 #define LSTAT(p, b) lstat(p, b) 498 #define LSTAT(p, b) lstat(p, b)
497 #define LSTAT64(p, b) lstat64(p, b) 499 #define LSTAT64(p, b) lstat64(p, b)
@@ -570,6 +572,7 @@ size_t strnlen (const char *str, size_t maxlen);
570 #define CHMOD(f, p) _win_chmod(f, p) 572 #define CHMOD(f, p) _win_chmod(f, p)
571 #define PIPE(h) _win_pipe(h) 573 #define PIPE(h) _win_pipe(h)
572 #define RANDOM() _win_random() 574 #define RANDOM() _win_random()
575 #define SRANDOM(s) _win_srandom()
573 #define REMOVE(p) _win_remove(p) 576 #define REMOVE(p) _win_remove(p)
574 #define RENAME(o, n) _win_rename(o, n) 577 #define RENAME(o, n) _win_rename(o, n)
575 #define STAT(p, b) _win_stat(p, b) 578 #define STAT(p, b) _win_stat(p, b)
diff --git a/src/util/test_container_bloomfilter.c b/src/util/test_container_bloomfilter.c
index 012d3f954..2e7fb2e28 100644
--- a/src/util/test_container_bloomfilter.c
+++ b/src/util/test_container_bloomfilter.c
@@ -69,7 +69,7 @@ main (int argc, char *argv[])
69 struct stat sbuf; 69 struct stat sbuf;
70 70
71 GNUNET_log_setup ("test-container-bloomfilter", "WARNING", NULL); 71 GNUNET_log_setup ("test-container-bloomfilter", "WARNING", NULL);
72 srand (1); 72 SRANDOM (1);
73 if (0 == stat (TESTFILE, &sbuf)) 73 if (0 == stat (TESTFILE, &sbuf))
74 if (0 != UNLINK (TESTFILE)) 74 if (0 != UNLINK (TESTFILE))
75 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", TESTFILE); 75 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", TESTFILE);
@@ -80,7 +80,7 @@ main (int argc, char *argv[])
80 nextHC (&tmp); 80 nextHC (&tmp);
81 GNUNET_CONTAINER_bloomfilter_add (bf, &tmp); 81 GNUNET_CONTAINER_bloomfilter_add (bf, &tmp);
82 } 82 }
83 srand (1); 83 SRANDOM (1);
84 ok1 = 0; 84 ok1 = 0;
85 for (i = 0; i < 200; i++) 85 for (i = 0; i < 200; i++)
86 { 86 {
@@ -108,7 +108,7 @@ main (int argc, char *argv[])
108 bfi = GNUNET_CONTAINER_bloomfilter_init (buf, SIZE, K); 108 bfi = GNUNET_CONTAINER_bloomfilter_init (buf, SIZE, K);
109 GNUNET_assert (bfi != NULL); 109 GNUNET_assert (bfi != NULL);
110 110
111 srand (1); 111 SRANDOM (1);
112 ok1 = 0; 112 ok1 = 0;
113 ok2 = 0; 113 ok2 = 0;
114 for (i = 0; i < 200; i++) 114 for (i = 0; i < 200; i++)
@@ -137,7 +137,7 @@ main (int argc, char *argv[])
137 return -1; 137 return -1;
138 } 138 }
139 139
140 srand (1); 140 SRANDOM (1);
141 for (i = 0; i < 100; i++) 141 for (i = 0; i < 100; i++)
142 { 142 {
143 nextHC (&tmp); 143 nextHC (&tmp);
@@ -145,7 +145,7 @@ main (int argc, char *argv[])
145 GNUNET_CONTAINER_bloomfilter_remove (bfi, &tmp); 145 GNUNET_CONTAINER_bloomfilter_remove (bfi, &tmp);
146 } 146 }
147 147
148 srand (1); 148 SRANDOM (1);
149 149
150 ok1 = 0; 150 ok1 = 0;
151 ok2 = 0; 151 ok2 = 0;
@@ -177,7 +177,7 @@ main (int argc, char *argv[])
177 return -1; 177 return -1;
178 } 178 }
179 179
180 srand (3); 180 SRANDOM (3);
181 181
182 GNUNET_CONTAINER_bloomfilter_clear (bf); 182 GNUNET_CONTAINER_bloomfilter_clear (bf);
183 falseok = 0; 183 falseok = 0;
@@ -201,14 +201,14 @@ main (int argc, char *argv[])
201 return -1; 201 return -1;
202 } 202 }
203 203
204 srand (2); 204 SRANDOM (2);
205 i = 20; 205 i = 20;
206 GNUNET_CONTAINER_bloomfilter_resize (bfi, &add_iterator, &i, SIZE * 2, K); 206 GNUNET_CONTAINER_bloomfilter_resize (bfi, &add_iterator, &i, SIZE * 2, K);
207 207
208 srand (2); 208 SRANDOM (2);
209 i = 20; 209 i = 20;
210 GNUNET_CONTAINER_bloomfilter_resize (bf, &add_iterator, &i, SIZE * 2, K); 210 GNUNET_CONTAINER_bloomfilter_resize (bf, &add_iterator, &i, SIZE * 2, K);
211 srand (2); 211 SRANDOM (2);
212 212
213 ok1 = 0; 213 ok1 = 0;
214 ok2 = 0; 214 ok2 = 0;