mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Remove nRef and vfsMutex from the sqlite3_vfs structure. Omit the
sqlite3_vfs_release() interface. Less memory allocated for a pager in the common case where the size of the pathname is less than MAX_PATH. (CVS 4287) FossilOrigin-Name: b8451da378179d43f25d9a014480c0f13dd1dc37
This commit is contained in:
24
src/os.c
24
src/os.c
@@ -199,34 +199,10 @@ sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){
|
||||
if( zVfs==0 ) break;
|
||||
if( strcmp(zVfs, pVfs->zName)==0 ) break;
|
||||
}
|
||||
if( pVfs ){
|
||||
pVfs->nRef++;
|
||||
assert( pVfs->nRef==1 || pVfs->vfsMutex!=0 );
|
||||
assert( pVfs->nRef>1 || pVfs->vfsMutex==0 );
|
||||
if( pVfs->vfsMutex==0 ){
|
||||
pVfs->vfsMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
|
||||
}
|
||||
}
|
||||
sqlite3_mutex_leave(mutex);
|
||||
return pVfs;
|
||||
}
|
||||
|
||||
/*
|
||||
** Release a VFS once it is no longer needed.
|
||||
*/
|
||||
int sqlite3_vfs_release(sqlite3_vfs *pVfs){
|
||||
sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER);
|
||||
sqlite3_mutex_enter(mutex);
|
||||
assert( pVfs->nRef>0 );
|
||||
pVfs->nRef--;
|
||||
if( pVfs->nRef==0 && pVfs->vfsMutex ){
|
||||
sqlite3_mutex_free(pVfs->vfsMutex);
|
||||
pVfs->vfsMutex = 0;
|
||||
}
|
||||
sqlite3_mutex_leave(mutex);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Unlink a VFS from the linked list
|
||||
*/
|
||||
|
Reference in New Issue
Block a user