mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Fix various internal #defines to conform to new C-language naming restrictions,
specifically that private-use macros names must not begin with "_". FossilOrigin-Name: 5471aca0158851d3fb0a2517306917536deb38bb
This commit is contained in:
28
src/os_win.c
28
src/os_win.c
@@ -3675,12 +3675,12 @@ struct winShm {
|
||||
/*
|
||||
** Apply advisory locks for all n bytes beginning at ofst.
|
||||
*/
|
||||
#define _SHM_UNLCK 1
|
||||
#define _SHM_RDLCK 2
|
||||
#define _SHM_WRLCK 3
|
||||
#define WINSHM_UNLCK 1
|
||||
#define WINSHM_RDLCK 2
|
||||
#define WINSHM_WRLCK 3
|
||||
static int winShmSystemLock(
|
||||
winShmNode *pFile, /* Apply locks to this open shared-memory segment */
|
||||
int lockType, /* _SHM_UNLCK, _SHM_RDLCK, or _SHM_WRLCK */
|
||||
int lockType, /* WINSHM_UNLCK, WINSHM_RDLCK, or WINSHM_WRLCK */
|
||||
int ofst, /* Offset to first byte to be locked/unlocked */
|
||||
int nByte /* Number of bytes to lock or unlock */
|
||||
){
|
||||
@@ -3693,12 +3693,12 @@ static int winShmSystemLock(
|
||||
pFile->hFile.h, lockType, ofst, nByte));
|
||||
|
||||
/* Release/Acquire the system-level lock */
|
||||
if( lockType==_SHM_UNLCK ){
|
||||
if( lockType==WINSHM_UNLCK ){
|
||||
rc = winUnlockFile(&pFile->hFile.h, ofst, 0, nByte, 0);
|
||||
}else{
|
||||
/* Initialize the locking parameters */
|
||||
DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY;
|
||||
if( lockType == _SHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK;
|
||||
if( lockType == WINSHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK;
|
||||
rc = winLockFile(&pFile->hFile.h, dwFlags, ofst, 0, nByte, 0);
|
||||
}
|
||||
|
||||
@@ -3710,7 +3710,7 @@ static int winShmSystemLock(
|
||||
}
|
||||
|
||||
OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n",
|
||||
pFile->hFile.h, (lockType == _SHM_UNLCK) ? "winUnlockFile" :
|
||||
pFile->hFile.h, (lockType == WINSHM_UNLCK) ? "winUnlockFile" :
|
||||
"winLockFile", pFile->lastErrno, sqlite3ErrName(rc)));
|
||||
|
||||
return rc;
|
||||
@@ -3838,7 +3838,7 @@ static int winOpenSharedMemory(winFile *pDbFd){
|
||||
/* Check to see if another process is holding the dead-man switch.
|
||||
** If not, truncate the file to zero length.
|
||||
*/
|
||||
if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){
|
||||
if( winShmSystemLock(pShmNode, WINSHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){
|
||||
rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
rc = winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(),
|
||||
@@ -3846,8 +3846,8 @@ static int winOpenSharedMemory(winFile *pDbFd){
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1);
|
||||
rc = winShmSystemLock(pShmNode, _SHM_RDLCK, WIN_SHM_DMS, 1);
|
||||
winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
|
||||
rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, WIN_SHM_DMS, 1);
|
||||
}
|
||||
if( rc ) goto shm_open_err;
|
||||
}
|
||||
@@ -3876,7 +3876,7 @@ static int winOpenSharedMemory(winFile *pDbFd){
|
||||
|
||||
/* Jump here on any error */
|
||||
shm_open_err:
|
||||
winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1);
|
||||
winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1);
|
||||
winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */
|
||||
sqlite3_free(p);
|
||||
sqlite3_free(pNew);
|
||||
@@ -3965,7 +3965,7 @@ static int winShmLock(
|
||||
|
||||
/* Unlock the system-level locks */
|
||||
if( (mask & allMask)==0 ){
|
||||
rc = winShmSystemLock(pShmNode, _SHM_UNLCK, ofst+WIN_SHM_BASE, n);
|
||||
rc = winShmSystemLock(pShmNode, WINSHM_UNLCK, ofst+WIN_SHM_BASE, n);
|
||||
}else{
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
@@ -3993,7 +3993,7 @@ static int winShmLock(
|
||||
/* Get shared locks at the system level, if necessary */
|
||||
if( rc==SQLITE_OK ){
|
||||
if( (allShared & mask)==0 ){
|
||||
rc = winShmSystemLock(pShmNode, _SHM_RDLCK, ofst+WIN_SHM_BASE, n);
|
||||
rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, ofst+WIN_SHM_BASE, n);
|
||||
}else{
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
@@ -4018,7 +4018,7 @@ static int winShmLock(
|
||||
** also mark the local connection as being locked.
|
||||
*/
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = winShmSystemLock(pShmNode, _SHM_WRLCK, ofst+WIN_SHM_BASE, n);
|
||||
rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, ofst+WIN_SHM_BASE, n);
|
||||
if( rc==SQLITE_OK ){
|
||||
assert( (p->sharedMask & mask)==0 );
|
||||
p->exclMask |= mask;
|
||||
|
||||
Reference in New Issue
Block a user