mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
tweak: don't restart whole loop on unlikely random result
This commit is contained in:
parent
ecef687471
commit
985f7bfea0
1 changed files with 4 additions and 4 deletions
|
@ -324,10 +324,10 @@ DBMgr::RegisterDevice( const DevID* host )
|
|||
for ( success = false, ii = 0; !success; ++ii ) {
|
||||
assert( 10 > ii ); // better to check that we're looping BECAUSE
|
||||
// of uniqueness problem.
|
||||
devID = (DevIDRelay)random();
|
||||
if ( DEVID_NONE == devID ) {
|
||||
continue;
|
||||
}
|
||||
do {
|
||||
devID = (DevIDRelay)random();
|
||||
} while ( DEVID_NONE != devID );
|
||||
|
||||
const char* command = "INSERT INTO " DEVICES_TABLE
|
||||
" (id, devType, devid)"
|
||||
" VALUES( $1, $2, $3 )";
|
||||
|
|
Loading…
Reference in a new issue