diff options
Diffstat (limited to '3rdparty/openpgm-svn-r1135/pgm/rand.c.c89.patch')
-rw-r--r-- | 3rdparty/openpgm-svn-r1135/pgm/rand.c.c89.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/3rdparty/openpgm-svn-r1135/pgm/rand.c.c89.patch b/3rdparty/openpgm-svn-r1135/pgm/rand.c.c89.patch new file mode 100644 index 0000000..074a3ef --- /dev/null +++ b/3rdparty/openpgm-svn-r1135/pgm/rand.c.c89.patch @@ -0,0 +1,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 |