summaryrefslogtreecommitdiffstats
path: root/3rdparty/openpgm-svn-r1135/pgm/rand.c.c89.patch
blob: 074a3ef1f4d9c8ea571b51d98a3d56467507585f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- rand.c	2010-05-21 11:35:31.000000000 +0800
+++ rand.c89	2010-08-04 15:44:47.000000000 +0800
@@ -31,7 +31,7 @@
 
 /* locals */
 
-static pgm_rand_t		global_rand = { .seed = 0 };
+static pgm_rand_t		global_rand = { 0 };
 static volatile uint32_t	rand_ref_count = 0;
 static pgm_mutex_t		rand_mutex;
 
@@ -81,8 +81,10 @@
 			return;
 	}
 #endif /* !_WIN32 */
+	{
 	const pgm_time_t now = pgm_time_update_now();
 	new_rand->seed = (uint32_t)pgm_to_msecs (now);
+	}
 }
 
 /* derived from POSIX.1-2001 example implementation of rand()
@@ -119,9 +121,11 @@
 	pgm_mutex_lock (&rand_mutex);
 	if (PGM_UNLIKELY(!global_rand.seed))
 		pgm_rand_create (&global_rand);
+	{
 	const uint32_t rand_value = pgm_rand_int (&global_rand);
 	pgm_mutex_unlock (&rand_mutex);
 	return rand_value;
+	}
 }
 
 int32_t