For-loop Syntax Error in Sqlite3.c
cppcheck has determined that the following statement produces a syntax error in sqlite3.c:
for(i=0; i<db->nDb; i++){
Full function:
SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){
int i;
Btree *p;
assert( sqlite3_mutex_held(db->mutex) );
for(i=0; i<db->nDb; i++){
p = db->aDb[i].pBt;
if( p && p->sharable ){
assert( p->wantToLock>0 );
p->wantToLock--;
if( p->wantToLock==0 ){
开发者_高级运维 unlockBtreeMutex(p);
}
}
}
}
I do not see how it is a syntax error. Please explain. Is this a false positive?
Looks like a false positive, however I can't reproduce it using Cppcheck 1.48 and C source code for SQLite 3.7.6.3.
If you're using different source or a different version, please log it as a bug.
CppCheck may be parsing the comparison expression incorrectly. Try adding some spaces or parenthesis to help out, Original:
i<db->nDb
Modified:
i < db->nDb
This is just my guess.
精彩评论