From: Kirill Yukhin <kyukhin@tarantool.org> To: v.shpilevoy@tarantool.org Cc: tarantool-patches@freelists.org, Kirill Yukhin <kyukhin@tarantool.org> Subject: [tarantool-patches] [PATCH 4/4] sql: Remove dead defines from sqliteInt.h Date: Mon, 26 Mar 2018 18:56:58 +0300 [thread overview] Message-ID: <76f17d808cff0aa89999a17aa3e6c438852aaf26.1522079350.git.kyukhin@tarantool.org> (raw) In-Reply-To: <cover.1522079349.git.kyukhin@tarantool.org> In-Reply-To: <cover.1522079349.git.kyukhin@tarantool.org> Massive removal of SQL legacy backend resulted in many unused macros. The patch removes them, partially though. Also, some minor coding style fixes done in sqliteInt.h. --- src/box/sql/global.c | 1 - src/box/sql/main.c | 64 ---------------------- src/box/sql/os.c | 2 +- src/box/sql/os_unix.c | 37 ++----------- src/box/sql/sqliteInt.h | 137 +++++++++--------------------------------------- 5 files changed, 30 insertions(+), 211 deletions(-) diff --git a/src/box/sql/global.c b/src/box/sql/global.c index 2304cbb..cd6f9c4 100644 --- a/src/box/sql/global.c +++ b/src/box/sql/global.c @@ -202,7 +202,6 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { 512, /* szLookaside */ 125, /* nLookaside */ 0, /* nStmtSpill */ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* pcache2 */ (void *)0, /* pHeap */ 0, /* nHeap */ 0, 0, /* mnHeap, mxHeap */ diff --git a/src/box/sql/main.c b/src/box/sql/main.c index 89c028d..1881e93 100644 --- a/src/box/sql/main.c +++ b/src/box/sql/main.c @@ -815,36 +815,15 @@ sqlite3ErrName(int rc) case SQLITE_BUSY: zName = "SQLITE_BUSY"; break; - case SQLITE_BUSY_RECOVERY: - zName = "SQLITE_BUSY_RECOVERY"; - break; - case SQLITE_BUSY_SNAPSHOT: - zName = "SQLITE_BUSY_SNAPSHOT"; - break; case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break; - case SQLITE_LOCKED_SHAREDCACHE: - zName = "SQLITE_LOCKED_SHAREDCACHE"; - break; case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break; case SQLITE_READONLY: zName = "SQLITE_READONLY"; break; - case SQLITE_READONLY_RECOVERY: - zName = "SQLITE_READONLY_RECOVERY"; - break; - case SQLITE_READONLY_CANTLOCK: - zName = "SQLITE_READONLY_CANTLOCK"; - break; - case SQLITE_READONLY_ROLLBACK: - zName = "SQLITE_READONLY_ROLLBACK"; - break; - case SQLITE_READONLY_DBMOVED: - zName = "SQLITE_READONLY_DBMOVED"; - break; case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break; @@ -938,18 +917,6 @@ sqlite3ErrName(int rc) case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; - case SQLITE_CANTOPEN_NOTEMPDIR: - zName = "SQLITE_CANTOPEN_NOTEMPDIR"; - break; - case SQLITE_CANTOPEN_ISDIR: - zName = "SQLITE_CANTOPEN_ISDIR"; - break; - case SQLITE_CANTOPEN_FULLPATH: - zName = "SQLITE_CANTOPEN_FULLPATH"; - break; - case SQLITE_CANTOPEN_CONVPATH: - zName = "SQLITE_CANTOPEN_CONVPATH"; - break; case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break; @@ -983,9 +950,6 @@ sqlite3ErrName(int rc) case SQLITE_CONSTRAINT_NOTNULL: zName = "SQLITE_CONSTRAINT_NOTNULL"; break; - case SQLITE_CONSTRAINT_COMMITHOOK: - zName = "SQLITE_CONSTRAINT_COMMITHOOK"; - break; case SQLITE_CONSTRAINT_FUNCTION: zName = "SQLITE_CONSTRAINT_FUNCTION"; break; @@ -1016,18 +980,9 @@ sqlite3ErrName(int rc) case SQLITE_NOTICE: zName = "SQLITE_NOTICE"; break; - case SQLITE_NOTICE_RECOVER_WAL: - zName = "SQLITE_NOTICE_RECOVER_WAL"; - break; - case SQLITE_NOTICE_RECOVER_ROLLBACK: - zName = "SQLITE_NOTICE_RECOVER_ROLLBACK"; - break; case SQLITE_WARNING: zName = "SQLITE_WARNING"; break; - case SQLITE_WARNING_AUTOINDEX: - zName = "SQLITE_WARNING_AUTOINDEX"; - break; case SQLITE_DONE: zName = "SQLITE_DONE"; break; @@ -1299,25 +1254,6 @@ sqlite3CreateFunc(sqlite3 * db, return SQLITE_OK; } -/* - * Create new user functions. - */ -int -sqlite3_create_function(sqlite3 * db, - const char *zFunc, - int nArg, - int flags, - void *p, - void (*xSFunc) (sqlite3_context *, int, - sqlite3_value **), - void (*xStep) (sqlite3_context *, int, - sqlite3_value **), - void (*xFinal) (sqlite3_context *)) -{ - return sqlite3_create_function_v2(db, zFunc, nArg, flags, p, xSFunc, - xStep, xFinal, 0); -} - int sqlite3_create_function_v2(sqlite3 * db, const char *zFunc, diff --git a/src/box/sql/os.c b/src/box/sql/os.c index ae98831..38d3585 100644 --- a/src/box/sql/os.c +++ b/src/box/sql/os.c @@ -287,7 +287,7 @@ sqlite3OsOpen(sqlite3_vfs * pVfs, DO_OS_MALLOC_TEST(0); /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed * down into the VFS layer. Some SQLITE_OPEN_ flags (for example, - * SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before + * SQLITE_OPEN_SHAREDCACHE) are blocked before * reaching the VFS. */ rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f7f, pFlagsOut); diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c index 4285d9f..8dce6f0 100644 --- a/src/box/sql/os_unix.c +++ b/src/box/sql/os_unix.c @@ -250,7 +250,6 @@ static pid_t randomnessPid = 0; #else #define UNIXFILE_DIRSYNC 0x00 #endif -#define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */ #define UNIXFILE_DELETE 0x20 /* Delete on close */ #define UNIXFILE_URI 0x40 /* Filename might have query parameters */ #define UNIXFILE_NOLOCK 0x80 /* Do no file locking */ @@ -3274,24 +3273,6 @@ fcntlSizeHint(unixFile * pFile, i64 nByte) return SQLITE_OK; } -/* - * If *pArg is initially negative then this is a query. Set *pArg to - * 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. - * - * If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. - */ -static void -unixModeBit(unixFile * pFile, unsigned char mask, int *pArg) -{ - if (*pArg < 0) { - *pArg = (pFile->ctrlFlags & mask) != 0; - } else if ((*pArg) == 0) { - pFile->ctrlFlags &= ~mask; - } else { - pFile->ctrlFlags |= mask; - } -} - /* Forward declaration */ static int unixGetTempname(int nBuf, char *zBuf); @@ -3322,10 +3303,6 @@ unixFileControl(sqlite3_file * id, int op, void *pArg) SimulateIOErrorBenign(0); return rc; } - case SQLITE_FCNTL_POWERSAFE_OVERWRITE:{ - unixModeBit(pFile, UNIXFILE_PSOW, (int *)pArg); - return SQLITE_OK; - } case SQLITE_FCNTL_VFSNAME:{ *(char **)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName); @@ -3416,14 +3393,10 @@ unixSectorSize(sqlite3_file * NotUsed) * available to turn it off and URI query parameter available to turn it off. */ static int -unixDeviceCharacteristics(sqlite3_file * id) +unixDeviceCharacteristics(sqlite3_file * pNotUsed) { - unixFile *p = (unixFile *) id; - int rc = 0; - if (p->ctrlFlags & UNIXFILE_PSOW) { - rc |= SQLITE_IOCAP_POWERSAFE_OVERWRITE; - } - return rc; + UNUSED_PARAMETER(pNotUsed); + return SQLITE_OK; } #if SQLITE_MAX_MMAP_SIZE>0 @@ -3965,10 +3938,6 @@ fillInUnixFile(sqlite3_vfs * pVfs, /* Pointer to vfs object */ #if SQLITE_MAX_MMAP_SIZE>0 pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap; #endif - if (sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0), - "psow", SQLITE_POWERSAFE_OVERWRITE)) { - pNew->ctrlFlags |= UNIXFILE_PSOW; - } if (strcmp(pVfs->zName, "unix-excl") == 0) { pNew->ctrlFlags |= UNIXFILE_EXCL; } diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h index 54456a2..6a6fb66 100644 --- a/src/box/sql/sqliteInt.h +++ b/src/box/sql/sqliteInt.h @@ -69,15 +69,6 @@ #include "box/txn.h" /* - * Make sure the Tcl calling convention macro is defined. This macro is - * only used by test code and Tcl integration code. - */ -#ifndef SQLITE_TCLAPI -#define SQLITE_TCLAPI -#endif - - -/* * These #defines should enable >2GB file support on POSIX if the * underlying operating system supports it. If the OS lacks * large file support, these should be no-ops. @@ -412,36 +403,6 @@ struct sqlite3_vfs { #define SQLITE_LIMIT_TRIGGER_DEPTH 9 #define SQLITE_LIMIT_WORKER_THREADS 10 -typedef struct sqlite3_pcache sqlite3_pcache; - -typedef struct sqlite3_pcache_page sqlite3_pcache_page; -struct sqlite3_pcache_page { - void *pBuf; /* The content of the page */ - void *pExtra; /* Extra information associated with the page */ -}; - -typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; -struct sqlite3_pcache_methods2 { - int iVersion; - void *pArg; - int (*xInit) (void *); - void (*xShutdown) (void *); - sqlite3_pcache *(*xCreate) (int szPage, int szExtra, - int bPurgeable); - void (*xCachesize) (sqlite3_pcache *, int nCachesize); - int (*xPagecount) (sqlite3_pcache *); - sqlite3_pcache_page *(*xFetch) (sqlite3_pcache *, unsigned key, - int createFlag); - void (*xUnpin) (sqlite3_pcache *, sqlite3_pcache_page *, - int discard); - void (*xRekey) (sqlite3_pcache *, sqlite3_pcache_page *, - unsigned oldKey, unsigned newKey); - void (*xTruncate) (sqlite3_pcache *, unsigned iLimit); - void (*xDestroy) (sqlite3_pcache *); - void (*xShrink) (sqlite3_pcache *); -}; - - #define SQLITE_OK 0 /* Successful result */ /* beginning-of-error-codes */ #define SQLITE_ERROR 1 /* SQL error or missing database */ @@ -506,90 +467,90 @@ sqlite3_strnicmp(const char *, const char *, int); const void * sqlite3_value_blob(sqlite3_value *); - int +int sqlite3_value_bytes(sqlite3_value *); - double +double sqlite3_value_double(sqlite3_value *); - int +int sqlite3_value_int(sqlite3_value *); - sqlite3_int64 +sqlite3_int64 sqlite3_value_int64(sqlite3_value *); - const unsigned char * +const unsigned char * sqlite3_value_text(sqlite3_value *); - int +int sqlite3_value_type(sqlite3_value *); - int +int sqlite3_value_numeric_type(sqlite3_value *); sqlite3 * sqlite3_context_db_handle(sqlite3_context *); - void +void sqlite3_result_blob(sqlite3_context *, const void *, int, void (*)(void *)); - void +void sqlite3_result_blob64(sqlite3_context *, const void *, sqlite3_uint64, void (*)(void *)); - void +void sqlite3_result_double(sqlite3_context *, double); - void +void sqlite3_result_error(sqlite3_context *, const char *, int); - void +void sqlite3_result_error_toobig(sqlite3_context *); - void +void sqlite3_result_error_nomem(sqlite3_context *); - void +void sqlite3_result_error_code(sqlite3_context *, int); - void +void sqlite3_result_int(sqlite3_context *, int); - void +void sqlite3_result_int64(sqlite3_context *, sqlite3_int64); - void +void sqlite3_result_null(sqlite3_context *); - void +void sqlite3_result_text(sqlite3_context *, const char *, int, void (*)(void *)); - void +void sqlite3_result_text64(sqlite3_context *, const char *, sqlite3_uint64, void (*)(void *)); - void +void sqlite3_result_value(sqlite3_context *, sqlite3_value *); - void +void sqlite3_result_zeroblob(sqlite3_context *, int n); - int +int sqlite3_result_zeroblob64(sqlite3_context *, sqlite3_uint64 n); - char * +char * sqlite3_mprintf(const char *, ...); - char * +char * sqlite3_vmprintf(const char *, va_list); - char * +char * sqlite3_snprintf(int, char *, const char *, ...); - char * +char * sqlite3_vsnprintf(int, char *, const char *, va_list); int @@ -688,30 +649,14 @@ sqlite3_exec(sqlite3 *, /* An open database */ #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8)) -#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) -#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) -#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) -#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) -#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) -#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) -#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) -#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) -#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) -#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) -#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) -#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) #define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5<<8)) #define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6<<8)) #define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8)) #define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8)) -#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) -#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) -#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) -#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) enum sql_type { SQLITE_INTEGER = 1, @@ -769,16 +714,8 @@ sqlite3_initialize(void); int sqlite3_os_end(void); -#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ -#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ -#define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ -#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ -#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ -#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ -#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ -/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ #define SQLITE_CONFIG_URI 17 /* int */ @@ -788,12 +725,9 @@ sqlite3_os_end(void); #define SQLITE_CONFIG_PMASZ 24 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 25 /* int nByte */ -#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ -#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ -#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ #define SQLITE_TRACE_STMT 0x01 @@ -844,9 +778,6 @@ sqlite3_create_function_v2(sqlite3 * db, #define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ #define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ -#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ -#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ @@ -961,21 +892,6 @@ sqlite3_limit(sqlite3 *, int id, int newVal); #define SQLITE_SYNC_FULL 0x00003 #define SQLITE_SYNC_DATAONLY 0x00010 -#define SQLITE_IOCAP_ATOMIC 0x00000001 -#define SQLITE_IOCAP_ATOMIC512 0x00000002 -#define SQLITE_IOCAP_ATOMIC1K 0x00000004 -#define SQLITE_IOCAP_ATOMIC2K 0x00000008 -#define SQLITE_IOCAP_ATOMIC4K 0x00000010 -#define SQLITE_IOCAP_ATOMIC8K 0x00000020 -#define SQLITE_IOCAP_ATOMIC16K 0x00000040 -#define SQLITE_IOCAP_ATOMIC32K 0x00000080 -#define SQLITE_IOCAP_ATOMIC64K 0x00000100 -#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 -#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 -#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 -#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 -#define SQLITE_IOCAP_IMMUTABLE 0x00002000 - int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); @@ -3292,7 +3208,6 @@ struct Sqlite3Config { int szLookaside; /* Default lookaside buffer size */ int nLookaside; /* Default lookaside buffer count */ int nStmtSpill; /* Stmt-journal spill-to-disk threshold */ - sqlite3_pcache_methods2 pcache2; /* Low-level page-cache interface */ void *pHeap; /* Heap storage space */ int nHeap; /* Size of pHeap[] */ int mnReq, mxReq; /* Min and max heap requests sizes */ -- 2.11.0
next prev parent reply other threads:[~2018-03-26 15:57 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-26 15:56 [tarantool-patches] [PATCH 0/4] Cleanup SQL memory and threading subsystems Kirill Yukhin 2018-03-26 15:56 ` [tarantool-patches] [PATCH 1/4] sql: Remove all references to sqlite3.h Kirill Yukhin 2018-03-26 15:56 ` [tarantool-patches] [PATCH 2/4] sql: remove mutexes around the code Kirill Yukhin 2018-03-26 15:56 ` [tarantool-patches] [PATCH 3/4] sql: remove dead memory allocation systems Kirill Yukhin 2018-03-26 15:56 ` Kirill Yukhin [this message] 2018-03-27 11:31 ` [tarantool-patches] Re: [PATCH 0/4] Cleanup SQL memory and threading subsystems v.shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=76f17d808cff0aa89999a17aa3e6c438852aaf26.1522079350.git.kyukhin@tarantool.org \ --to=kyukhin@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH 4/4] sql: Remove dead defines from sqliteInt.h' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox