diff options
author | mistachkin <mistachkin@noemail.net> | 2014-10-27 19:58:29 +0000 |
---|---|---|
committer | mistachkin <mistachkin@noemail.net> | 2014-10-27 19:58:29 +0000 |
commit | df9c093e2c516c011ec476cf220d477eea70983c (patch) | |
tree | 7392a4fd85ff9dd0026e70c357a11f72441d0075 /src | |
parent | a95d8ca1fad1133a39ab65c60e7b7346f9089749 (diff) | |
download | sqlite-df9c093e2c516c011ec476cf220d477eea70983c.tar.gz sqlite-df9c093e2c516c011ec476cf220d477eea70983c.zip |
Fix compilation issue with MSVC due to a misplaced variable declaration.
FossilOrigin-Name: 9588b345d09daaa49d24d7fb6cab732e64e5474e
Diffstat (limited to 'src')
-rw-r--r-- | src/random.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/random.c b/src/random.c index c4241362d..bd109e71b 100644 --- a/src/random.c +++ b/src/random.c @@ -34,10 +34,6 @@ void sqlite3_randomness(int N, void *pBuf){ unsigned char t; unsigned char *zBuf = pBuf; -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return; -#endif - /* The "wsdPrng" macro will resolve to the pseudo-random number generator ** state vector. If writable static data is unsupported on the target, ** we have to locate the state vector at run-time. In the more common @@ -52,13 +48,23 @@ void sqlite3_randomness(int N, void *pBuf){ #endif #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG); + sqlite3_mutex *mutex; +#endif + +#ifndef SQLITE_OMIT_AUTOINIT + if( sqlite3_initialize() ) return; +#endif + +#if SQLITE_THREADSAFE + mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG); sqlite3_mutex_enter(mutex); #endif if( N<=0 || pBuf==0 ){ wsdPrng.isInit = 0; +#if SQLITE_THREADSAFE sqlite3_mutex_leave(mutex); +#endif return; } |