/ Check-in [2b9340c8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove a small amount of unnecessary #ifdeffery from random.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2b9340c8684bc382391e02813e960b3166f24daa
User & Date: drh 2014-10-27 20:14:02
Context
2014-10-27
22:06
Add special handling for static mutexes in sqlite3_mutex_alloc() when automatic calls to sqlite3_initialize() are enabled. check-in: 7857d27c user: mistachkin tags: trunk
20:14
Remove a small amount of unnecessary #ifdeffery from random.c. check-in: 2b9340c8 user: drh tags: trunk
19:58
Fix compilation issue with MSVC due to a misplaced variable declaration. check-in: 9588b345 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/random.c.

53
54
55
56
57
58
59
60
61
62

63
64
65
66
67
68
69
70
71
72
73
74

#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;
  }

  /* Initialize the state of the random number generator once,
  ** the first time this routine is called.  The seed value does
  ** not need to contain a lot of randomness since we are not
  ** trying to do secure encryption or anything like that...







<


>


<

<







53
54
55
56
57
58
59

60
61
62
63
64

65

66
67
68
69
70
71
72

#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return;
#endif

#if SQLITE_THREADSAFE
  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);

#endif

  sqlite3_mutex_enter(mutex);
  if( N<=0 || pBuf==0 ){
    wsdPrng.isInit = 0;

    sqlite3_mutex_leave(mutex);

    return;
  }

  /* Initialize the state of the random number generator once,
  ** the first time this routine is called.  The seed value does
  ** not need to contain a lot of randomness since we are not
  ** trying to do secure encryption or anything like that...