From 344347ca4c004a30d14136cd6d4fed51f525eeff Mon Sep 17 00:00:00 2001 From: ahgamut <41098605+ahgamut@users.noreply.github.com> Date: Tue, 4 May 2021 20:09:59 +0530 Subject: [PATCH] Get SQLite to build * changed headers * removed redundant declarations * ran clang-format * added sqlite3.mk --- third_party/sqlite3/alter.c | 2 +- third_party/sqlite3/analyze.c | 2 +- third_party/sqlite3/attach.c | 2 +- third_party/sqlite3/auth.c | 2 +- third_party/sqlite3/backup.c | 4 +- third_party/sqlite3/bitvec.c | 2 +- third_party/sqlite3/btmutex.c | 2 +- third_party/sqlite3/btree.c | 2 +- third_party/sqlite3/btree.h | 2 +- third_party/sqlite3/btreeInt.h | 2 +- third_party/sqlite3/build.c | 2 +- third_party/sqlite3/callback.c | 2 +- third_party/sqlite3/complete.c | 2 +- third_party/sqlite3/ctime.c | 2 +- third_party/sqlite3/date.c | 11 +- third_party/sqlite3/dbpage.c | 2 +- third_party/sqlite3/dbstat.c | 2 +- third_party/sqlite3/delete.c | 2 +- third_party/sqlite3/expr.c | 2 +- third_party/sqlite3/fault.c | 2 +- third_party/sqlite3/fkey.c | 2 +- third_party/sqlite3/fts3.c | 17 +-- third_party/sqlite3/fts3.h | 2 +- third_party/sqlite3/fts3Int.h | 8 +- third_party/sqlite3/fts3_aux.c | 6 +- third_party/sqlite3/fts3_expr.c | 8 +- third_party/sqlite3/fts3_hash.c | 11 +- third_party/sqlite3/fts3_icu.c | 14 +- third_party/sqlite3/fts3_porter.c | 13 +- third_party/sqlite3/fts3_snippet.c | 6 +- third_party/sqlite3/fts3_tokenize_vtab.c | 6 +- third_party/sqlite3/fts3_tokenizer.c | 12 +- third_party/sqlite3/fts3_tokenizer.h | 2 +- third_party/sqlite3/fts3_tokenizer1.c | 13 +- third_party/sqlite3/fts3_unicode.c | 13 +- third_party/sqlite3/fts3_unicode2.c | 2 +- third_party/sqlite3/fts3_write.c | 11 +- third_party/sqlite3/fts5.c | 56 ++++---- third_party/sqlite3/fts5.h | 2 +- third_party/sqlite3/func.c | 11 +- third_party/sqlite3/geopoly.c | 8 +- third_party/sqlite3/global.c | 4 +- third_party/sqlite3/hash.c | 5 +- third_party/sqlite3/icu.c | 13 +- third_party/sqlite3/insert.c | 2 +- third_party/sqlite3/json1.c | 14 +- third_party/sqlite3/legacy.c | 2 +- third_party/sqlite3/loadext.c | 4 +- third_party/sqlite3/main.c | 8 +- third_party/sqlite3/malloc.c | 3 +- third_party/sqlite3/mem0.c | 2 +- third_party/sqlite3/mem1.c | 4 +- third_party/sqlite3/mem2.c | 4 +- third_party/sqlite3/mem3.c | 2 +- third_party/sqlite3/mem5.c | 2 +- third_party/sqlite3/memdb.c | 2 +- third_party/sqlite3/memjournal.c | 2 +- third_party/sqlite3/mutex.c | 2 +- third_party/sqlite3/mutex_noop.c | 2 +- third_party/sqlite3/mutex_unix.c | 2 +- third_party/sqlite3/mutex_w32.c | 6 +- third_party/sqlite3/notify.c | 4 +- third_party/sqlite3/os.c | 2 +- third_party/sqlite3/os.h | 2 +- third_party/sqlite3/os_common.h | 2 +- third_party/sqlite3/os_unix.c | 72 +++++----- third_party/sqlite3/os_win.c | 8 +- third_party/sqlite3/os_win.h | 5 +- third_party/sqlite3/pager.c | 4 +- third_party/sqlite3/parse.c | 6 +- third_party/sqlite3/pcache.c | 2 +- third_party/sqlite3/pcache1.c | 2 +- third_party/sqlite3/pragma.c | 4 +- third_party/sqlite3/prepare.c | 2 +- third_party/sqlite3/printf.c | 2 +- third_party/sqlite3/random.c | 2 +- third_party/sqlite3/resolve.c | 2 +- third_party/sqlite3/rowset.c | 2 +- third_party/sqlite3/rtree.c | 16 +-- third_party/sqlite3/rtree.h | 2 +- third_party/sqlite3/select.c | 2 +- third_party/sqlite3/shell.c | 172 +++++++++++------------ third_party/sqlite3/sqlite3.h | 4 +- third_party/sqlite3/sqlite3.mk | 102 ++++++++++++++ third_party/sqlite3/sqlite3ext.h | 2 +- third_party/sqlite3/sqlite3rbu.c | 14 +- third_party/sqlite3/sqlite3rbu.h | 2 +- third_party/sqlite3/sqlite3rtree.h | 2 +- third_party/sqlite3/sqlite3session.c | 10 +- third_party/sqlite3/sqlite3session.h | 2 +- third_party/sqlite3/sqliteInt.h | 49 ++++--- third_party/sqlite3/sqliteicu.h | 2 +- third_party/sqlite3/status.c | 4 +- third_party/sqlite3/stmt.c | 6 +- third_party/sqlite3/table.c | 2 +- third_party/sqlite3/threads.c | 4 +- third_party/sqlite3/tokenize.c | 7 +- third_party/sqlite3/treeview.c | 2 +- third_party/sqlite3/trigger.c | 2 +- third_party/sqlite3/update.c | 2 +- third_party/sqlite3/upsert.c | 2 +- third_party/sqlite3/userauth.c | 2 +- third_party/sqlite3/utf.c | 7 +- third_party/sqlite3/util.c | 5 +- third_party/sqlite3/vacuum.c | 4 +- third_party/sqlite3/vdbe.c | 6 +- third_party/sqlite3/vdbe.h | 4 +- third_party/sqlite3/vdbeapi.c | 4 +- third_party/sqlite3/vdbeaux.c | 4 +- third_party/sqlite3/vdbeblob.c | 4 +- third_party/sqlite3/vdbemem.c | 4 +- third_party/sqlite3/vdbesort.c | 4 +- third_party/sqlite3/vdbetrace.c | 4 +- third_party/sqlite3/vdbevtab.c | 4 +- third_party/sqlite3/vtab.c | 2 +- third_party/sqlite3/wal.c | 2 +- third_party/sqlite3/wal.h | 2 +- third_party/sqlite3/walker.c | 7 +- third_party/sqlite3/where.c | 4 +- third_party/sqlite3/wherecode.c | 4 +- third_party/sqlite3/whereexpr.c | 4 +- third_party/sqlite3/window.c | 2 +- 122 files changed, 528 insertions(+), 449 deletions(-) create mode 100644 third_party/sqlite3/sqlite3.mk diff --git a/third_party/sqlite3/alter.c b/third_party/sqlite3/alter.c index 9debf8e7e..1e31bdb21 100644 --- a/third_party/sqlite3/alter.c +++ b/third_party/sqlite3/alter.c @@ -12,7 +12,7 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** The code in this file only exists if we are not omitting the diff --git a/third_party/sqlite3/analyze.c b/third_party/sqlite3/analyze.c index 960ed4f7d..fc19b7127 100644 --- a/third_party/sqlite3/analyze.c +++ b/third_party/sqlite3/analyze.c @@ -140,7 +140,7 @@ ** integer in the equivalent columns in sqlite_stat4. */ #ifndef SQLITE_OMIT_ANALYZE -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if defined(SQLITE_ENABLE_STAT4) #define IsStat4 1 diff --git a/third_party/sqlite3/attach.c b/third_party/sqlite3/attach.c index 03f364dda..a07395f07 100644 --- a/third_party/sqlite3/attach.c +++ b/third_party/sqlite3/attach.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_ATTACH /* diff --git a/third_party/sqlite3/auth.c b/third_party/sqlite3/auth.c index 544b2d05a..f6d9f196d 100644 --- a/third_party/sqlite3/auth.c +++ b/third_party/sqlite3/auth.c @@ -14,7 +14,7 @@ ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** All of the code in this file may be omitted by defining a single diff --git a/third_party/sqlite3/backup.c b/third_party/sqlite3/backup.c index 629169f0f..3f703a440 100644 --- a/third_party/sqlite3/backup.c +++ b/third_party/sqlite3/backup.c @@ -12,8 +12,8 @@ ** This file contains the implementation of the sqlite3_backup_XXX() ** API functions and the related features. */ -#include "btreeInt.h" -#include "sqliteInt.h" +#include "third_party/sqlite3/btreeInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Structure allocated for each backup operation. diff --git a/third_party/sqlite3/bitvec.c b/third_party/sqlite3/bitvec.c index 9b4dd1482..b833db925 100644 --- a/third_party/sqlite3/bitvec.c +++ b/third_party/sqlite3/bitvec.c @@ -34,7 +34,7 @@ ** start of a transaction, and is thus usually less than a few thousand, ** but can be as large as 2 billion for a really big database. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* Size of the Bitvec structure in bytes. */ #define BITVEC_SZ 512 diff --git a/third_party/sqlite3/btmutex.c b/third_party/sqlite3/btmutex.c index 6fa49e623..eb77b3fd2 100644 --- a/third_party/sqlite3/btmutex.c +++ b/third_party/sqlite3/btmutex.c @@ -15,7 +15,7 @@ ** big and we want to break it down some. This packaged seemed like ** a good breakout. */ -#include "btreeInt.h" +#include "third_party/sqlite3/btreeInt.h" #ifndef SQLITE_OMIT_SHARED_CACHE #if SQLITE_THREADSAFE diff --git a/third_party/sqlite3/btree.c b/third_party/sqlite3/btree.c index d93e9c1b2..d478d8257 100644 --- a/third_party/sqlite3/btree.c +++ b/third_party/sqlite3/btree.c @@ -13,7 +13,7 @@ ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ -#include "btreeInt.h" +#include "third_party/sqlite3/btreeInt.h" /* ** The header string that appears at the beginning of every diff --git a/third_party/sqlite3/btree.h b/third_party/sqlite3/btree.h index 4bbb8ddf4..b3e7ccdff 100644 --- a/third_party/sqlite3/btree.h +++ b/third_party/sqlite3/btree.h @@ -353,7 +353,7 @@ void sqlite3BtreeCursorList(Btree *); #endif #ifndef SQLITE_OMIT_WAL -int sqlite3BtreeCheckpoint(Btree *, int, int *, int *); +/* int sqlite3BtreeCheckpoint(Btree *, int, int *, int *); */ #endif int sqlite3BtreeTransferRow(BtCursor *, BtCursor *, i64); diff --git a/third_party/sqlite3/btreeInt.h b/third_party/sqlite3/btreeInt.h index e17b7ec88..214260dd6 100644 --- a/third_party/sqlite3/btreeInt.h +++ b/third_party/sqlite3/btreeInt.h @@ -213,7 +213,7 @@ ** 4 Number of leaf pointers on this page ** * zero or more pages numbers of leaves */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* The following value is the maximum cell size assuming a maximum page ** size give above. diff --git a/third_party/sqlite3/build.c b/third_party/sqlite3/build.c index 921a0b693..6edfbbc2b 100644 --- a/third_party/sqlite3/build.c +++ b/third_party/sqlite3/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_SHARED_CACHE /* diff --git a/third_party/sqlite3/callback.c b/third_party/sqlite3/callback.c index 21cec087f..76bd79fbb 100644 --- a/third_party/sqlite3/callback.c +++ b/third_party/sqlite3/callback.c @@ -14,7 +14,7 @@ ** of user defined functions and collation sequences. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Invoke the 'collation needed' callback to request a collation sequence diff --git a/third_party/sqlite3/complete.c b/third_party/sqlite3/complete.c index c5b645ac3..50df1d4a3 100644 --- a/third_party/sqlite3/complete.c +++ b/third_party/sqlite3/complete.c @@ -16,7 +16,7 @@ ** separating it out, the code will be automatically omitted from ** static links that do not use it. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_COMPLETE /* diff --git a/third_party/sqlite3/ctime.c b/third_party/sqlite3/ctime.c index 910c78581..935971d94 100644 --- a/third_party/sqlite3/ctime.c +++ b/third_party/sqlite3/ctime.c @@ -21,7 +21,7 @@ ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "config.h" +#include "third_party/sqlite3/config.h" #define SQLITECONFIG_H 1 #endif diff --git a/third_party/sqlite3/date.c b/third_party/sqlite3/date.c index c8ed065d2..d23a2e0e5 100644 --- a/third_party/sqlite3/date.c +++ b/third_party/sqlite3/date.c @@ -43,11 +43,12 @@ ** Willmann-Bell, Inc ** Richmond, Virginia (USA) */ -#include -#include -#include - -#include "sqliteInt.h" +#include "libc/assert.h" +#include "libc/calls/weirdtypes.h" +#include "libc/mem/mem.h" +#include "libc/time/struct/tm.h" +#include "libc/time/time.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_DATETIME_FUNCS diff --git a/third_party/sqlite3/dbpage.c b/third_party/sqlite3/dbpage.c index f7b0422e7..5f80280a2 100644 --- a/third_party/sqlite3/dbpage.c +++ b/third_party/sqlite3/dbpage.c @@ -31,7 +31,7 @@ ** update fails. Rows may not be deleted or inserted. */ -#include "sqliteInt.h" /* Requires access to internal data structures */ +#include "third_party/sqlite3/sqliteInt.h" /* Requires access to internal data structures */ #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) && \ !defined(SQLITE_OMIT_VIRTUALTABLE) diff --git a/third_party/sqlite3/dbstat.c b/third_party/sqlite3/dbstat.c index 2879235eb..c26a5442d 100644 --- a/third_party/sqlite3/dbstat.c +++ b/third_party/sqlite3/dbstat.c @@ -21,7 +21,7 @@ ** official SQLite documentation. */ -#include "sqliteInt.h" /* Requires access to internal data structures */ +#include "third_party/sqlite3/sqliteInt.h" /* Requires access to internal data structures */ #if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) && \ !defined(SQLITE_OMIT_VIRTUALTABLE) diff --git a/third_party/sqlite3/delete.c b/third_party/sqlite3/delete.c index 347fd40d1..367ae15bd 100644 --- a/third_party/sqlite3/delete.c +++ b/third_party/sqlite3/delete.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** in order to generate code for DELETE FROM statements. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** While a SrcList can in general represent multiple tables and subqueries diff --git a/third_party/sqlite3/expr.c b/third_party/sqlite3/expr.c index 1f1f4496e..783d2c9aa 100644 --- a/third_party/sqlite3/expr.c +++ b/third_party/sqlite3/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* Forward declarations */ static void exprCodeBetween(Parse *, Expr *, int, diff --git a/third_party/sqlite3/fault.c b/third_party/sqlite3/fault.c index 57b4feb89..0c8544520 100644 --- a/third_party/sqlite3/fault.c +++ b/third_party/sqlite3/fault.c @@ -24,7 +24,7 @@ ** during a hash table resize is a benign fault. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_UNTESTABLE diff --git a/third_party/sqlite3/fkey.c b/third_party/sqlite3/fkey.c index fddcd49e7..0975ab108 100644 --- a/third_party/sqlite3/fkey.c +++ b/third_party/sqlite3/fkey.c @@ -11,7 +11,7 @@ ** This file contains code used by the compiler to add foreign key ** support to compiled SQL statements. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_FOREIGN_KEY #ifndef SQLITE_OMIT_TRIGGER diff --git a/third_party/sqlite3/fts3.c b/third_party/sqlite3/fts3.c index 1123c3304..3be0e2df5 100644 --- a/third_party/sqlite3/fts3.c +++ b/third_party/sqlite3/fts3.c @@ -288,23 +288,20 @@ ** older data. */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) #if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE) #define SQLITE_CORE 1 #endif -#include -#include -#include -#include -#include -#include - -#include "fts3.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/fts3.h" #ifndef SQLITE_CORE -#include "sqlite3ext.h" +#include "third_party/sqlite3/sqlite3ext.h" SQLITE_EXTENSION_INIT1 #endif diff --git a/third_party/sqlite3/fts3.h b/third_party/sqlite3/fts3.h index e696ade9d..453ba1cce 100644 --- a/third_party/sqlite3/fts3.h +++ b/third_party/sqlite3/fts3.h @@ -13,7 +13,7 @@ ** This header file is used by programs that want to link against the ** FTS3 library. All it does is declare the sqlite3Fts3Init() interface. */ -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #ifdef __cplusplus extern "C" { diff --git a/third_party/sqlite3/fts3Int.h b/third_party/sqlite3/fts3Int.h index 06b57b039..e43c9e00d 100644 --- a/third_party/sqlite3/fts3Int.h +++ b/third_party/sqlite3/fts3Int.h @@ -37,13 +37,13 @@ /* If not building as part of the core, include sqlite3ext.h. */ #ifndef SQLITE_CORE -#include "sqlite3ext.h" +#include "third_party/sqlite3/sqlite3ext.h" SQLITE_EXTENSION_INIT3 #endif -#include "fts3_hash.h" -#include "fts3_tokenizer.h" -#include "sqlite3.h" +#include "third_party/sqlite3/fts3_hash.h" +#include "third_party/sqlite3/fts3_tokenizer.h" +#include "third_party/sqlite3/sqlite3.h" /* ** This constant determines the maximum depth of an FTS expression tree diff --git a/third_party/sqlite3/fts3_aux.c b/third_party/sqlite3/fts3_aux.c index 2e3ddee97..3c5269871 100644 --- a/third_party/sqlite3/fts3_aux.c +++ b/third_party/sqlite3/fts3_aux.c @@ -11,11 +11,11 @@ ****************************************************************************** ** */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" typedef struct Fts3auxTable Fts3auxTable; typedef struct Fts3auxCursor Fts3auxCursor; diff --git a/third_party/sqlite3/fts3_expr.c b/third_party/sqlite3/fts3_expr.c index 0e9951b79..df5e9cbc3 100644 --- a/third_party/sqlite3/fts3_expr.c +++ b/third_party/sqlite3/fts3_expr.c @@ -15,7 +15,7 @@ ** syntax is relatively simple, the whole tokenizer/parser system is ** hand-coded. */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) /* @@ -78,8 +78,8 @@ int sqlite3_fts3_enable_parentheses = 0; */ #define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* ** isNot: @@ -1096,7 +1096,7 @@ void sqlite3Fts3ExprFree(Fts3Expr *pDel) { #ifdef SQLITE_TEST -#include +#include "libc/stdio/stdio.h" /* ** Return a pointer to a buffer containing a text representation of the diff --git a/third_party/sqlite3/fts3_hash.c b/third_party/sqlite3/fts3_hash.c index df8547e3d..9b380f2f7 100644 --- a/third_party/sqlite3/fts3_hash.c +++ b/third_party/sqlite3/fts3_hash.c @@ -23,14 +23,13 @@ ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include -#include - -#include "fts3_hash.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/fts3_hash.h" /* ** Malloc and Free functions diff --git a/third_party/sqlite3/fts3_icu.c b/third_party/sqlite3/fts3_icu.c index 5183884d8..2cf699f69 100644 --- a/third_party/sqlite3/fts3_icu.c +++ b/third_party/sqlite3/fts3_icu.c @@ -11,18 +11,14 @@ ************************************************************************* ** This file implements a tokenizer for fts3 based on the ICU library. */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) #ifdef SQLITE_ENABLE_ICU -#include -#include -#include -#include -#include -#include - -#include "fts3_tokenizer.h" +#include "libc/assert.h" +#include "libc/str/str.h" +#include "libc/unicode/unicode.h" +#include "third_party/sqlite3/fts3_tokenizer.h" typedef struct IcuTokenizer IcuTokenizer; typedef struct IcuCursor IcuCursor; diff --git a/third_party/sqlite3/fts3_porter.c b/third_party/sqlite3/fts3_porter.c index 8a6b98c89..a9cad393f 100644 --- a/third_party/sqlite3/fts3_porter.c +++ b/third_party/sqlite3/fts3_porter.c @@ -22,15 +22,14 @@ ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include -#include -#include - -#include "fts3_tokenizer.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/fts3_tokenizer.h" /* ** Class derived from sqlite3_tokenizer diff --git a/third_party/sqlite3/fts3_snippet.c b/third_party/sqlite3/fts3_snippet.c index 1f6c226d8..c57aa0fb6 100644 --- a/third_party/sqlite3/fts3_snippet.c +++ b/third_party/sqlite3/fts3_snippet.c @@ -11,11 +11,11 @@ ****************************************************************************** */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* ** Characters that may appear in the second argument to matchinfo(). diff --git a/third_party/sqlite3/fts3_tokenize_vtab.c b/third_party/sqlite3/fts3_tokenize_vtab.c index ae9011f37..5ede54963 100644 --- a/third_party/sqlite3/fts3_tokenize_vtab.c +++ b/third_party/sqlite3/fts3_tokenize_vtab.c @@ -38,11 +38,11 @@ ** pos: Token offset of token within input. ** */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" typedef struct Fts3tokTable Fts3tokTable; typedef struct Fts3tokCursor Fts3tokCursor; diff --git a/third_party/sqlite3/fts3_tokenizer.c b/third_party/sqlite3/fts3_tokenizer.c index 0c40620bc..3c5fba75c 100644 --- a/third_party/sqlite3/fts3_tokenizer.c +++ b/third_party/sqlite3/fts3_tokenizer.c @@ -23,11 +23,11 @@ ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* ** Return true if the two-argument version of fts3_tokenizer() @@ -226,11 +226,11 @@ int sqlite3Fts3InitTokenizer( #ifdef SQLITE_TEST #if defined(INCLUDE_SQLITE_TCL_H) -#include "sqlite_tcl.h" +#include "third_party/sqlite3/sqlite_tcl.h" #else -#include "tcl.h" +#include "third_party/sqlite3/tcl.h" #endif -#include +#include "libc/str/str.h" /* ** Implementation of a special SQL scalar function for testing tokenizers diff --git a/third_party/sqlite3/fts3_tokenizer.h b/third_party/sqlite3/fts3_tokenizer.h index a04759ac1..4c741ed1a 100644 --- a/third_party/sqlite3/fts3_tokenizer.h +++ b/third_party/sqlite3/fts3_tokenizer.h @@ -24,7 +24,7 @@ ** If tokenizers are to be allowed to call sqlite3_*() functions, then ** we will need a way to register the API consistently. */ -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" /* ** Structures used by the tokenizer interface. When a new tokenizer diff --git a/third_party/sqlite3/fts3_tokenizer1.c b/third_party/sqlite3/fts3_tokenizer1.c index 2358dd53e..189f7e72b 100644 --- a/third_party/sqlite3/fts3_tokenizer1.c +++ b/third_party/sqlite3/fts3_tokenizer1.c @@ -22,15 +22,14 @@ ** * The FTS3 module is being built into the core of ** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include -#include -#include - -#include "fts3_tokenizer.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/fts3_tokenizer.h" typedef struct simple_tokenizer { sqlite3_tokenizer base; diff --git a/third_party/sqlite3/fts3_unicode.c b/third_party/sqlite3/fts3_unicode.c index 3f135070d..f409bf6c4 100644 --- a/third_party/sqlite3/fts3_unicode.c +++ b/third_party/sqlite3/fts3_unicode.c @@ -15,15 +15,14 @@ #ifndef SQLITE_DISABLE_FTS3_UNICODE -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include -#include -#include - -#include "fts3_tokenizer.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/fts3_tokenizer.h" /* ** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied diff --git a/third_party/sqlite3/fts3_unicode2.c b/third_party/sqlite3/fts3_unicode2.c index f43d3b55c..8d146a727 100644 --- a/third_party/sqlite3/fts3_unicode2.c +++ b/third_party/sqlite3/fts3_unicode2.c @@ -18,7 +18,7 @@ #ifndef SQLITE_DISABLE_FTS3_UNICODE #if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) -#include +#include "libc/assert.h" /* ** Return true if the argument corresponds to a unicode codepoint diff --git a/third_party/sqlite3/fts3_write.c b/third_party/sqlite3/fts3_write.c index 0c45d5475..0b13d437b 100644 --- a/third_party/sqlite3/fts3_write.c +++ b/third_party/sqlite3/fts3_write.c @@ -17,13 +17,14 @@ ** code in fts3.c. */ -#include "fts3Int.h" +#include "third_party/sqlite3/fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#include -#include -#include -#include +#include "libc/alg/alg.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" #define FTS_MAX_APPENDABLE_HEIGHT 16 diff --git a/third_party/sqlite3/fts5.c b/third_party/sqlite3/fts5.c index 4960e0d9a..5449f83d5 100644 --- a/third_party/sqlite3/fts5.c +++ b/third_party/sqlite3/fts5.c @@ -32,7 +32,7 @@ #ifndef _FTS5_H #define _FTS5_H -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #ifdef __cplusplus extern "C" { @@ -589,12 +589,12 @@ struct fts5_api { #ifndef _FTS5INT_H #define _FTS5INT_H -/* #include "fts5.h" */ -#include "sqlite3ext.h" +/* #include "third_party/sqlite3/fts5.h" */ +#include "third_party/sqlite3/sqlite3ext.h" SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_AMALGAMATION @@ -1424,8 +1424,8 @@ static void sqlite3Fts5UnicodeAscii(u8 *, u8 *); /************ Begin %include sections from the grammar ************************/ #line 47 "fts5parse.y" -/* #include "fts5Int.h" */ -/* #include "fts5parse.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ +/* #include "third_party/sqlite3/fts5parse.h" */ /* ** Disable all error recovery processing in the parser push-down @@ -1766,8 +1766,8 @@ struct fts5yyParser { typedef struct fts5yyParser fts5yyParser; #ifndef NDEBUG -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" static FILE *fts5yyTraceFILE = 0; static char *fts5yyTracePrompt = 0; #endif /* NDEBUG */ @@ -3054,8 +3054,8 @@ static int sqlite3Fts5ParserFallback(int iToken) { ****************************************************************************** */ -/* #include "fts5Int.h" */ -#include /* amalgamator: keep */ +/* #include "third_party/sqlite3/fts5Int.h" */ +#include "libc/math.h" /* amalgamator: keep */ /* ** Object used to iterate through all "coalesced phrase instances" in @@ -3756,7 +3756,7 @@ static int sqlite3Fts5AuxInit(fts5_api *pApi) { ****************************************************************************** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ static int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte) { if ((u32)pBuf->nSpace < nByte) { @@ -4133,7 +4133,7 @@ static void sqlite3Fts5TermsetFree(Fts5Termset *p) { ** This is an SQLite module implementing full-text search. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ #define FTS5_DEFAULT_PAGE_SIZE 4050 #define FTS5_DEFAULT_AUTOMERGE 4 @@ -5071,8 +5071,8 @@ static int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie) { ** */ -/* #include "fts5Int.h" */ -/* #include "fts5parse.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ +/* #include "third_party/sqlite3/fts5parse.h" */ /* ** All token types in the generated fts5parse.h file are greater than 0. @@ -5086,14 +5086,14 @@ typedef struct Fts5ExprTerm Fts5ExprTerm; /* ** Functions generated by lemon from fts5parse.y. */ -static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); -static void sqlite3Fts5ParserFree(void *, void (*freeProc)(void *)); -static void sqlite3Fts5Parser(void *, int, Fts5Token, Fts5Parse *); +// static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); +// static void sqlite3Fts5ParserFree(void *, void (*freeProc)(void *)); +// static void sqlite3Fts5Parser(void *, int, Fts5Token, Fts5Parse *); #ifndef NDEBUG -#include +#include "libc/stdio/stdio.h" static void sqlite3Fts5ParserTrace(FILE *, char *); #endif -static int sqlite3Fts5ParserFallback(int); +// static int sqlite3Fts5ParserFallback(int); struct Fts5Expr { Fts5Index *pIndex; @@ -8044,7 +8044,7 @@ static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *pExpr, int iPhrase, ** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ typedef struct Fts5HashEntry Fts5HashEntry; @@ -8594,7 +8594,7 @@ static void sqlite3Fts5HashScanEntry( ** the interface defined in fts5Int.h. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ /* ** Overview: @@ -15133,7 +15133,7 @@ static int sqlite3Fts5IndexReset(Fts5Index *p) { ** This is an SQLite module implementing full-text search. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ /* ** This variable is set to false when running tests for which the on disk @@ -17930,7 +17930,7 @@ int sqlite3Fts5Init(sqlite3 *db) { ** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ struct Fts5Storage { Fts5Config *pConfig; @@ -19023,7 +19023,7 @@ static int sqlite3Fts5StorageConfigValue(Fts5Storage *p, const char *z, ****************************************************************************** */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ /************************************************************************** ** Start of ascii tokenizer implementation. @@ -20381,7 +20381,7 @@ static int sqlite3Fts5TokenizerInit(fts5_api *pApi) { ** DO NOT EDIT THIS MACHINE GENERATED FILE. */ -#include +#include "libc/assert.h" /* ** If the argument is a codepoint corresponding to a lowercase letter @@ -21169,7 +21169,7 @@ static void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii) { ** Routines for varint serialization and deserialization. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ /* ** This is a copy of the sqlite3GetVarint32() routine from the SQLite core. @@ -21525,7 +21525,7 @@ static int sqlite3Fts5GetVarintLen(u32 iVal) { ** One row for each term instance in the database. */ -/* #include "fts5Int.h" */ +/* #include "third_party/sqlite3/fts5Int.h" */ typedef struct Fts5VocabTable Fts5VocabTable; typedef struct Fts5VocabCursor Fts5VocabCursor; diff --git a/third_party/sqlite3/fts5.h b/third_party/sqlite3/fts5.h index 1ac519cd4..066e2dcfb 100644 --- a/third_party/sqlite3/fts5.h +++ b/third_party/sqlite3/fts5.h @@ -20,7 +20,7 @@ #ifndef _FTS5_H #define _FTS5_H -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #ifdef __cplusplus extern "C" { diff --git a/third_party/sqlite3/func.c b/third_party/sqlite3/func.c index 183a27f9e..01c95a1c2 100644 --- a/third_party/sqlite3/func.c +++ b/third_party/sqlite3/func.c @@ -13,14 +13,13 @@ ** functions of SQLite. (Some function, and in particular the date and ** time functions, are implemented separately.) */ -#include -#include - -#include "sqliteInt.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_FLOATING_POINT -#include +#include "libc/math.h" #endif -#include "vdbeInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* ** Return the collating function associated with a function. diff --git a/third_party/sqlite3/geopoly.c b/third_party/sqlite3/geopoly.c index dd24d8b45..0d200c707 100644 --- a/third_party/sqlite3/geopoly.c +++ b/third_party/sqlite3/geopoly.c @@ -16,7 +16,11 @@ ** This file is #include-ed onto the end of "rtree.c" so that it has ** access to all of the R-Tree internals. */ -#include +#include "libc/fmt/conv.h" +#include "libc/mem/mem.h" +#include "third_party/gdtoa/gdtoa.h" +#include "third_party/sqlite3/rtree.h" +#include "third_party/sqlite3/sqlite3.h" /* Enable -DGEOPOLY_ENABLE_DEBUG for debugging facilities */ #ifdef GEOPOLY_ENABLE_DEBUG @@ -40,7 +44,7 @@ static int geo_debug = 0; #define safe_isxdigit(x) sqlite3Isxdigit(x) #else /* Use the standard library for separate compilation */ -#include /* amalgamator: keep */ +#include "libc/str/str.h" /* amalgamator: keep */ #define safe_isdigit(x) isdigit((unsigned char)(x)) #define safe_isalnum(x) isalnum((unsigned char)(x)) #define safe_isxdigit(x) isxdigit((unsigned char)(x)) diff --git a/third_party/sqlite3/global.c b/third_party/sqlite3/global.c index e21a2659c..d146ab008 100644 --- a/third_party/sqlite3/global.c +++ b/third_party/sqlite3/global.c @@ -12,7 +12,7 @@ ** ** This file contains definitions of global variables and constants. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* An array to map all upper-case characters into their corresponding ** lower-case character. @@ -787,7 +787,7 @@ int sqlite3PendingByte = 0x40000000; u32 sqlite3SelectTrace = 0; u32 sqlite3WhereTrace = 0; -#include "opcodes.h" +#include "third_party/sqlite3/opcodes.h" /* ** Properties of opcodes. The OPFLG_INITIALIZER macro is ** created by mkopcodeh.awk during compilation. Data is obtained diff --git a/third_party/sqlite3/hash.c b/third_party/sqlite3/hash.c index 66525c4c8..945beaf7f 100644 --- a/third_party/sqlite3/hash.c +++ b/third_party/sqlite3/hash.c @@ -12,9 +12,8 @@ ** This is the implementation of generic hash-tables ** used in SQLite. */ -#include - -#include "sqliteInt.h" +#include "libc/assert.h" +#include "third_party/sqlite3/sqliteInt.h" /* Turn bulk memory into a hash table object by initializing the ** fields of the Hash structure. diff --git a/third_party/sqlite3/icu.c b/third_party/sqlite3/icu.c index 971d99220..2a279a874 100644 --- a/third_party/sqlite3/icu.c +++ b/third_party/sqlite3/icu.c @@ -28,21 +28,18 @@ ** provide case-independent matching. */ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) || \ +#if 0 && !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) || \ defined(SQLITE_ENABLE_ICU_COLLATIONS) /* Include ICU headers */ -#include -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/unicode/unicode.h" #ifndef SQLITE_CORE -#include "sqlite3ext.h" +#include "third_party/sqlite3/sqlite3ext.h" SQLITE_EXTENSION_INIT1 #else -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #endif /* diff --git a/third_party/sqlite3/insert.c b/third_party/sqlite3/insert.c index 44fc84480..fdddafb74 100644 --- a/third_party/sqlite3/insert.c +++ b/third_party/sqlite3/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Generate code that will diff --git a/third_party/sqlite3/json1.c b/third_party/sqlite3/json1.c index 31be9e3c2..5ccc81eeb 100644 --- a/third_party/sqlite3/json1.c +++ b/third_party/sqlite3/json1.c @@ -23,13 +23,13 @@ */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) #if !defined(SQLITEINT_H) -#include "sqlite3ext.h" +#include "third_party/sqlite3/sqlite3ext.h" #endif SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/str/str.h" +#include "third_party/gdtoa/gdtoa.h" /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -58,7 +58,7 @@ SQLITE_EXTENSION_INIT1 #define safe_isxdigit(x) sqlite3Isxdigit(x) #else /* Use the standard library for separate compilation */ -#include /* amalgamator: keep */ +#include "libc/str/str.h" /* amalgamator: keep */ #define safe_isdigit(x) isdigit((unsigned char)(x)) #define safe_isalnum(x) isalnum((unsigned char)(x)) #define safe_isxdigit(x) isxdigit((unsigned char)(x)) @@ -708,7 +708,7 @@ static int jsonParseAddNode(JsonParse *, u32, u32, const char *); ** inlined. */ #if defined(__GNUC__) -#define JSON_NOINLINE __attribute__((noinline)) +#define JSON_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 #define JSON_NOINLINE __declspec(noinline) #else diff --git a/third_party/sqlite3/legacy.c b/third_party/sqlite3/legacy.c index 270e714b0..d194617b0 100644 --- a/third_party/sqlite3/legacy.c +++ b/third_party/sqlite3/legacy.c @@ -15,7 +15,7 @@ ** accessed by users of the library. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Execute SQL code. Return one of the SQLITE_ success/failure diff --git a/third_party/sqlite3/loadext.c b/third_party/sqlite3/loadext.c index 9512876da..453fd1606 100644 --- a/third_party/sqlite3/loadext.c +++ b/third_party/sqlite3/loadext.c @@ -16,8 +16,8 @@ #ifndef SQLITE_CORE #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ #endif -#include "sqlite3ext.h" -#include "sqliteInt.h" +#include "third_party/sqlite3/sqlite3ext.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_LOAD_EXTENSION /* diff --git a/third_party/sqlite3/main.c b/third_party/sqlite3/main.c index 006e7d37a..15c772faa 100644 --- a/third_party/sqlite3/main.c +++ b/third_party/sqlite3/main.c @@ -14,16 +14,16 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifdef SQLITE_ENABLE_FTS3 -#include "fts3.h" +#include "third_party/sqlite3/fts3.h" #endif #ifdef SQLITE_ENABLE_RTREE -#include "rtree.h" +#include "third_party/sqlite3/rtree.h" #endif #if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS) -#include "sqliteicu.h" +#include "third_party/sqlite3/sqliteicu.h" #endif /* diff --git a/third_party/sqlite3/malloc.c b/third_party/sqlite3/malloc.c index acd9a09d0..a4047f2f6 100644 --- a/third_party/sqlite3/malloc.c +++ b/third_party/sqlite3/malloc.c @@ -12,9 +12,8 @@ ** ** Memory allocation functions used throughout sqlite. */ -#include -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Attempt to release up to n bytes of non-essential memory currently diff --git a/third_party/sqlite3/mem0.c b/third_party/sqlite3/mem0.c index a720eff57..2a1bf684b 100644 --- a/third_party/sqlite3/mem0.c +++ b/third_party/sqlite3/mem0.c @@ -16,7 +16,7 @@ ** are merely placeholders. Real drivers must be substituted using ** sqlite3_config() before SQLite will operate. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** This version of the memory allocator is the default. It is diff --git a/third_party/sqlite3/mem1.c b/third_party/sqlite3/mem1.c index 6ad8bc7af..0355e29c3 100644 --- a/third_party/sqlite3/mem1.c +++ b/third_party/sqlite3/mem1.c @@ -41,7 +41,7 @@ ** be necessary when compiling for Delphi, ** for example. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** This version of the memory allocator is the default. It is @@ -103,7 +103,7 @@ static malloc_zone_t *_sqliteZone_; ** the macro SQLITE_MALLOCSIZE to the desired function name. */ #if defined(SQLITE_USE_MALLOC_H) -#include +#include "libc/mem/mem.h" #if defined(SQLITE_USE_MALLOC_USABLE_SIZE) #if !defined(SQLITE_MALLOCSIZE) #define SQLITE_MALLOCSIZE(x) malloc_usable_size(x) diff --git a/third_party/sqlite3/mem2.c b/third_party/sqlite3/mem2.c index 119e3dbcd..d7f0c845c 100644 --- a/third_party/sqlite3/mem2.c +++ b/third_party/sqlite3/mem2.c @@ -19,7 +19,7 @@ ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** This version of the memory allocator is used only if the @@ -37,7 +37,7 @@ extern void backtrace_symbols_fd(void *const *, int, int); #define backtrace(A, B) 1 #define backtrace_symbols_fd(A, B, C) #endif -#include +#include "libc/stdio/stdio.h" /* ** Each memory allocation looks like this: diff --git a/third_party/sqlite3/mem3.c b/third_party/sqlite3/mem3.c index fbbaab4ec..c12dabd00 100644 --- a/third_party/sqlite3/mem3.c +++ b/third_party/sqlite3/mem3.c @@ -23,7 +23,7 @@ ** This version of the memory allocation subsystem is included ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** This version of the memory allocator is only built into the library diff --git a/third_party/sqlite3/mem5.c b/third_party/sqlite3/mem5.c index 1305b155b..46df1804b 100644 --- a/third_party/sqlite3/mem5.c +++ b/third_party/sqlite3/mem5.c @@ -48,7 +48,7 @@ ** The sqlite3_status() logic tracks the maximum values of n and M so ** that an application can, at any time, verify this constraint. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** This version of the memory allocator is used only when diff --git a/third_party/sqlite3/memdb.c b/third_party/sqlite3/memdb.c index 8f7707d3a..527dd4c5f 100644 --- a/third_party/sqlite3/memdb.c +++ b/third_party/sqlite3/memdb.c @@ -16,7 +16,7 @@ ** This file also implements interface sqlite3_serialize() and ** sqlite3_deserialize(). */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifdef SQLITE_ENABLE_DESERIALIZE /* diff --git a/third_party/sqlite3/memjournal.c b/third_party/sqlite3/memjournal.c index 930ef0deb..07ae016a0 100644 --- a/third_party/sqlite3/memjournal.c +++ b/third_party/sqlite3/memjournal.c @@ -23,7 +23,7 @@ ** in the common case, they are usually small and no file I/O needs to ** occur. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* Forward references to internal structures */ typedef struct MemJournal MemJournal; diff --git a/third_party/sqlite3/mutex.c b/third_party/sqlite3/mutex.c index b2f4feffc..6fbcb6829 100644 --- a/third_party/sqlite3/mutex.c +++ b/third_party/sqlite3/mutex.c @@ -13,7 +13,7 @@ ** ** This file contains code that is common across all mutex implementations. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT) /* diff --git a/third_party/sqlite3/mutex_noop.c b/third_party/sqlite3/mutex_noop.c index abb4345aa..b53a2accc 100644 --- a/third_party/sqlite3/mutex_noop.c +++ b/third_party/sqlite3/mutex_noop.c @@ -25,7 +25,7 @@ ** that does error checking on mutexes to make sure they are being ** called correctly. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_MUTEX_OMIT diff --git a/third_party/sqlite3/mutex_unix.c b/third_party/sqlite3/mutex_unix.c index 85be1092a..6ae47b206 100644 --- a/third_party/sqlite3/mutex_unix.c +++ b/third_party/sqlite3/mutex_unix.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains the C functions that implement mutexes for pthreads */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** The code in this file is only used if we are compiling threadsafe diff --git a/third_party/sqlite3/mutex_w32.c b/third_party/sqlite3/mutex_w32.c index bf933c5d3..5fde42b36 100644 --- a/third_party/sqlite3/mutex_w32.c +++ b/third_party/sqlite3/mutex_w32.c @@ -11,18 +11,18 @@ ************************************************************************* ** This file contains the C functions that implement mutexes for Win32. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if SQLITE_OS_WIN /* ** Include code that is common to all os_*.c files */ -#include "os_common.h" +#include "third_party/sqlite3/os_common.h" /* ** Include the header file for the Windows VFS. */ -#include "os_win.h" +#include "third_party/sqlite3/os_win.h" #endif /* diff --git a/third_party/sqlite3/notify.c b/third_party/sqlite3/notify.c index 654d20564..810c620a9 100644 --- a/third_party/sqlite3/notify.c +++ b/third_party/sqlite3/notify.c @@ -13,8 +13,8 @@ ** This file contains the implementation of the sqlite3_unlock_notify() ** API method and its associated functionality. */ -#include "btreeInt.h" -#include "sqliteInt.h" +#include "third_party/sqlite3/btreeInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY diff --git a/third_party/sqlite3/os.c b/third_party/sqlite3/os.c index 2f81a5b73..4d223c869 100644 --- a/third_party/sqlite3/os.c +++ b/third_party/sqlite3/os.c @@ -13,7 +13,7 @@ ** This file contains OS interface code that is common to all ** architectures. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** If we compile with the SQLITE_TEST macro set, then the following block diff --git a/third_party/sqlite3/os.h b/third_party/sqlite3/os.h index a06d51be6..109868bd5 100644 --- a/third_party/sqlite3/os.h +++ b/third_party/sqlite3/os.h @@ -24,7 +24,7 @@ ** Attempt to automatically detect the operating system and setup the ** necessary pre-processor macros for it. */ -#include "os_setup.h" +#include "third_party/sqlite3/os_setup.h" /* If the SET_FULLSYNC macro is not defined above, then make it ** a no-op diff --git a/third_party/sqlite3/os_common.h b/third_party/sqlite3/os_common.h index 7738b6ed9..cbf57566d 100644 --- a/third_party/sqlite3/os_common.h +++ b/third_party/sqlite3/os_common.h @@ -39,7 +39,7 @@ ** hwtime.h contains inline assembler code for implementing ** high-performance timing routines. */ -#include "hwtime.h" +#include "third_party/sqlite3/hwtime.h" static sqlite_uint64 g_start; static sqlite_uint64 g_elapsed; diff --git a/third_party/sqlite3/os_unix.c b/third_party/sqlite3/os_unix.c index 954952db7..e3723b3f1 100644 --- a/third_party/sqlite3/os_unix.c +++ b/third_party/sqlite3/os_unix.c @@ -43,7 +43,7 @@ ** * Definitions of sqlite3_vfs objects for all locking methods ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ /* @@ -87,16 +87,22 @@ /* ** standard include files. */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "libc/calls/calls.h" +#include "libc/calls/struct/flock.h" +#include "libc/calls/weirdtypes.h" +#include "libc/errno.h" +#include "libc/isystem/unistd.h" +#include "libc/runtime/sysconf.h" +#include "libc/sysv/consts/f.h" +#include "libc/sysv/consts/map.h" +#include "libc/sysv/consts/mremap.h" +#include "libc/sysv/consts/o.h" +#include "libc/sysv/consts/ok.h" +#include "libc/sysv/consts/prot.h" +#include "libc/time/struct/tm.h" +#include "libc/time/time.h" #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE > 0 -#include +#include "libc/mem/mem.h" #endif #if SQLITE_ENABLE_LOCKING_STYLE @@ -133,9 +139,10 @@ #endif #if OS_VXWORKS -#include #include #include + +#include "libc/limits.h" #endif /* OS_VXWORKS */ #if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE @@ -143,7 +150,7 @@ #endif #ifdef HAVE_UTIME -#include +#include "libc/time/time.h" #endif /* @@ -296,7 +303,7 @@ static pid_t randomnessPid = 0; /* ** Include code that is common to all os_*.c files */ -#include "os_common.h" +#include "third_party/sqlite3/os_common.h" /* ** Define various macros that are missing from some systems. @@ -868,23 +875,18 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) { (sqliteIOErr == SQLITE_IOERR_UNLOCK) || (sqliteIOErr == SQLITE_IOERR_RDLOCK) || (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK)); - switch (posixError) { - case EACCES: - case EAGAIN: - case ETIMEDOUT: - case EBUSY: - case EINTR: - case ENOLCK: - /* random NFS retry error, unless during file system support - * introspection, in which it actually means what it says */ - return SQLITE_BUSY; + // changed switch to if-else + if (posixError == EACCES || posixError == EAGAIN || posixError == ETIMEDOUT || + posixError == EBUSY || posixError == EINTR || posixError == ENOLCK) + /* random NFS retry error, unless during file system support + * introspection, in which it actually means what it says */ + return SQLITE_BUSY; - case EPERM: - return SQLITE_PERM; + else if (posixError == EPERM) + return SQLITE_PERM; - default: - return sqliteIOErr; - } + else + return sqliteIOErr; } /****************************************************************************** @@ -3373,17 +3375,17 @@ static int unixRead(sqlite3_file *id, void *pBuf, int amt, ** prior to returning to the application by the sqlite3ApiExit() ** routine. */ - switch (pFile->lastErrno) { - case ERANGE: - case EIO: + // changed switch to if-else + if (pFile->lastErrno == ERANGE || pFile->lastErrno == EIO #ifdef ENXIO - case ENXIO: + || pFile->lastErrno == ENXIO #endif #ifdef EDEVERR - case EDEVERR: + || pFile->lastErrno == EDEVERR #endif - return SQLITE_IOERR_CORRUPTFS; - } + ) + return SQLITE_IOERR_CORRUPTFS; + return SQLITE_IOERR_READ; } else { storeLastErrno(pFile, 0); /* not a system error */ diff --git a/third_party/sqlite3/os_win.c b/third_party/sqlite3/os_win.c index a56404c7e..2657c0baa 100644 --- a/third_party/sqlite3/os_win.c +++ b/third_party/sqlite3/os_win.c @@ -12,18 +12,18 @@ ** ** This file contains code that is specific to Windows. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if SQLITE_OS_WIN /* This file is used for Windows only */ /* ** Include code that is common to all os_*.c files */ -#include "os_common.h" +#include "third_party/sqlite3/os_common.h" /* ** Include the header file for the Windows VFS. */ -#include "os_win.h" +#include "third_party/sqlite3/os_win.h" /* ** Compiling and using WAL mode requires several APIs that are only @@ -2200,7 +2200,7 @@ static void winLogIoerr(int nRetry, int lineno) { ** The MSVC CRT on Windows CE may not have a localtime() function. ** So define a substitute. */ -#include +#include "libc/time/time.h" struct tm *__cdecl localtime(const time_t *t) { static struct tm y; FILETIME uTm, lTm; diff --git a/third_party/sqlite3/os_win.h b/third_party/sqlite3/os_win.h index bba496f29..afd0059db 100644 --- a/third_party/sqlite3/os_win.h +++ b/third_party/sqlite3/os_win.h @@ -18,11 +18,12 @@ /* ** Include the primary Windows SDK header file. */ -#include "windows.h" +#include "third_party/sqlite3/windows.h" #ifdef __CYGWIN__ -#include /* amalgamator: dontcache */ #include + +#include "libc/errno.h" /* amalgamator: dontcache */ #endif /* diff --git a/third_party/sqlite3/pager.c b/third_party/sqlite3/pager.c index be912a0f5..3f66c7073 100644 --- a/third_party/sqlite3/pager.c +++ b/third_party/sqlite3/pager.c @@ -19,8 +19,8 @@ ** another is writing. */ #ifndef SQLITE_OMIT_DISKIO -#include "sqliteInt.h" -#include "wal.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/wal.h" /******************* NOTES ON THE DESIGN OF THE PAGER ************************ ** diff --git a/third_party/sqlite3/parse.c b/third_party/sqlite3/parse.c index 854da0184..b77c96695 100644 --- a/third_party/sqlite3/parse.c +++ b/third_party/sqlite3/parse.c @@ -22,7 +22,7 @@ */ #line 58 "parse.y" -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Disable all error recovery processing in the parser push-down @@ -4652,8 +4652,8 @@ struct yyParser { typedef struct yyParser yyParser; #ifndef NDEBUG -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ diff --git a/third_party/sqlite3/pcache.c b/third_party/sqlite3/pcache.c index 8ddf38e0f..27575324e 100644 --- a/third_party/sqlite3/pcache.c +++ b/third_party/sqlite3/pcache.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file implements that page cache. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** A complete page cache is an instance of this structure. Every diff --git a/third_party/sqlite3/pcache1.c b/third_party/sqlite3/pcache1.c index ac669e81e..68695bc57 100644 --- a/third_party/sqlite3/pcache1.c +++ b/third_party/sqlite3/pcache1.c @@ -80,7 +80,7 @@ ** show that method (3) with N==100 provides about a 5% performance boost for ** common workloads. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" typedef struct PCache1 PCache1; typedef struct PgHdr1 PgHdr1; diff --git a/third_party/sqlite3/pragma.c b/third_party/sqlite3/pragma.c index 7ce79cc9a..b08c9c43f 100644 --- a/third_party/sqlite3/pragma.c +++ b/third_party/sqlite3/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if !defined(SQLITE_ENABLE_LOCKING_STYLE) #if defined(__APPLE__) @@ -28,7 +28,7 @@ ** lexicographical order to facility a binary search of the pragma name. ** Do not edit pragma.h directly. Edit and rerun the script in at ** ../tool/mkpragmatab.tcl. */ -#include "pragma.h" +#include "third_party/sqlite3/pragma.h" /* ** Interpret the given string as a safety level. Return 0 for OFF, diff --git a/third_party/sqlite3/prepare.c b/third_party/sqlite3/prepare.c index ba6383496..acdf48f9f 100644 --- a/third_party/sqlite3/prepare.c +++ b/third_party/sqlite3/prepare.c @@ -13,7 +13,7 @@ ** interface, and routines that contribute to loading the database schema ** from disk. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Fill the InitData structure with an error message that indicates diff --git a/third_party/sqlite3/printf.c b/third_party/sqlite3/printf.c index c7c8c8e2c..8938a446b 100644 --- a/third_party/sqlite3/printf.c +++ b/third_party/sqlite3/printf.c @@ -9,7 +9,7 @@ ** library, though the implementation here has enhancements to support ** SQLite. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Conversion types fall into various categories as defined by the diff --git a/third_party/sqlite3/random.c b/third_party/sqlite3/random.c index 91b02cb19..b634f4937 100644 --- a/third_party/sqlite3/random.c +++ b/third_party/sqlite3/random.c @@ -15,7 +15,7 @@ ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* All threads share a single random number generator. ** This structure is the current state of the generator. diff --git a/third_party/sqlite3/resolve.c b/third_party/sqlite3/resolve.c index 97a89f861..a0b5f3393 100644 --- a/third_party/sqlite3/resolve.c +++ b/third_party/sqlite3/resolve.c @@ -14,7 +14,7 @@ ** resolve all identifiers by associating them with a particular ** table and column. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Magic table number to mean the EXCLUDED table in an UPSERT statement. diff --git a/third_party/sqlite3/rowset.c b/third_party/sqlite3/rowset.c index b72ca68fb..aae0b89c5 100644 --- a/third_party/sqlite3/rowset.c +++ b/third_party/sqlite3/rowset.c @@ -61,7 +61,7 @@ ** be possible, but the feature was not used, so it was removed in order ** to simplify the code. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Target size for allocation chunks. diff --git a/third_party/sqlite3/rtree.c b/third_party/sqlite3/rtree.c index 70a097f2e..d10f9b676 100644 --- a/third_party/sqlite3/rtree.c +++ b/third_party/sqlite3/rtree.c @@ -57,15 +57,15 @@ (defined(SQLITE_ENABLE_RTREE) && !defined(SQLITE_OMIT_VIRTUALTABLE)) #ifndef SQLITE_CORE -#include "sqlite3ext.h" +#include "third_party/sqlite3/sqlite3ext.h" SQLITE_EXTENSION_INIT1 #else -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #endif int sqlite3GetToken(const unsigned char *, int *); /* In the SQLite core */ #ifndef SQLITE_AMALGAMATION -#include "sqlite3rtree.h" +#include "third_party/sqlite3/sqlite3rtree.h" typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef unsigned char u8; @@ -79,10 +79,10 @@ typedef unsigned int u32; #endif #endif -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" /* The following macro is used to suppress compiler warnings. */ @@ -4313,7 +4313,7 @@ static void rtreecheck(sqlite3_context *ctx, int nArg, sqlite3_value **apArg) { /* Conditionally include the geopoly code */ #ifdef SQLITE_ENABLE_GEOPOLY -#include "geopoly.c" +#include "third_party/sqlite3/geopoly.c" #endif /* diff --git a/third_party/sqlite3/rtree.h b/third_party/sqlite3/rtree.h index 564d8c56a..5272caf61 100644 --- a/third_party/sqlite3/rtree.h +++ b/third_party/sqlite3/rtree.h @@ -13,7 +13,7 @@ ** This header file is used by programs that want to link against the ** RTREE library. All it does is declare the sqlite3RtreeInit() interface. */ -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #ifdef SQLITE_OMIT_VIRTUALTABLE #undef SQLITE_ENABLE_RTREE diff --git a/third_party/sqlite3/select.c b/third_party/sqlite3/select.c index b6b66ea80..c1fc9a365 100644 --- a/third_party/sqlite3/select.c +++ b/third_party/sqlite3/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** An instance of the following object is used to record information about diff --git a/third_party/sqlite3/shell.c b/third_party/sqlite3/shell.c index c39b26783..f51a54086 100644 --- a/third_party/sqlite3/shell.c +++ b/third_party/sqlite3/shell.c @@ -82,30 +82,30 @@ #define _LARGEFILE_SOURCE 1 #endif -#include -#include -#include -#include - -#include "sqlite3.h" +#include "libc/assert.h" +#include "libc/fmt/conv.h" +#include "libc/fmt/fmt.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/sqlite3.h" typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef unsigned char u8; #if SQLITE_USER_AUTHENTICATION -#include "sqlite3userauth.h" +#include "third_party/sqlite3/sqlite3userauth.h" #endif -#include -#include +#include "libc/str/str.h" #if !defined(_WIN32) && !defined(WIN32) -#include +#include "libc/calls/sigbits.h" #if !defined(__RTP__) && !defined(_WRS_KERNEL) -#include +#include "third_party/musl/passwd.h" #endif #endif #if (!defined(_WIN32) && !defined(WIN32)) || defined(__MINGW32__) -#include -#include +#include "libc/calls/calls.h" +#include "libc/isystem/unistd.h" #define GETPID getpid #if defined(__MINGW32__) #define DIRENT dirent @@ -116,8 +116,7 @@ typedef unsigned char u8; #else #define GETPID (int)GetCurrentProcessId #endif -#include -#include +#include "libc/calls/weirdtypes.h" #if HAVE_READLINE #include @@ -138,7 +137,7 @@ typedef unsigned char u8; #elif HAVE_LINENOISE -#include "linenoise.h" +#include "third_party/sqlite3/linenoise.h" #define shell_add_history(X) linenoiseHistoryAdd(X) #define shell_read_history(X) linenoiseHistoryLoad(X) #define shell_write_history(X) linenoiseHistorySave(X) @@ -177,13 +176,10 @@ typedef unsigned char u8; #endif #else /* Make sure isatty() has a prototype. */ -extern int isatty(int); #if !defined(__RTP__) && !defined(_WRS_KERNEL) /* popen and pclose are not C89 functions and so are -** sometimes omitted from the header */ -extern FILE *popen(const char *, const char *); -extern int pclose(FILE *); +** sometimes omitted from the "libc/stdio/stdio.h" header */ #else #define SQLITE_OMIT_POPEN 1 #endif @@ -254,8 +250,8 @@ static sqlite3_int64 timeOfDay(void) { } #if !defined(_WIN32) && !defined(WIN32) && !defined(__minux) -#include -#include +#include "libc/sysv/consts/rusage.h" +#include "libc/time/time.h" /* VxWorks does not support getrusage() as far as we can determine */ #if defined(_WRS_KERNEL) || defined(__RTP__) @@ -1050,25 +1046,23 @@ static void shellAddSchemaName(sqlite3_context *pCtx, int nVal, #define WIN32_LEAN_AND_MEAN #endif -#include "windows.h" +#include "third_party/sqlite3/windows.h" /* ** We need several support functions from the SQLite core. */ -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/sqlite3.h" */ /* ** We need several things from the ANSI and MSVCRT headers. */ -#include -#include -#include -#include -#include -#include -#include +#include "libc/calls/weirdtypes.h" +#include "libc/errno.h" +#include "libc/limits.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" /* ** We may need several defines that should have been in "sys/stat.h". @@ -1203,7 +1197,7 @@ extern INT closedir(LPDIR dirp); */ #if defined(_WIN32) && defined(_MSC_VER) -/* #include "test_windirent.h" */ +/* #include "third_party/sqlite3/test_windirent.h" */ /* ** Implementation of the POSIX getenv() function using the Win32 API. @@ -1399,11 +1393,10 @@ INT closedir(LPDIR dirp) { ** is used. If SIZE is included it must be one of the integers 224, 256, ** 384, or 512, to determine SHA3 hash variant that is computed. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_AMALGAMATION /* typedef sqlite3_uint64 u64; */ @@ -2152,24 +2145,22 @@ int sqlite3_shathree_init(sqlite3 *db, char **pzErrMsg, ** And the paths returned in the "name" column of the table are also ** relative to directory $dir. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/calls/calls.h" +#include "libc/calls/weirdtypes.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" #if !defined(_WIN32) && !defined(WIN32) -#include -#include -#include -#include +#include "libc/calls/sigbits.h" +#include "libc/isystem/unistd.h" +#include "libc/time/time.h" #else #include #include -#include "windows.h" +#include "third_party/sqlite3/windows.h" /* # include "test_windirent.h" */ #define dirent DIRENT #ifndef chmod @@ -2181,8 +2172,8 @@ SQLITE_EXTENSION_INIT1 #define mkdir(path, mode) _mkdir(path) #define lstat(path, buf) stat(path, buf) #endif -#include -#include +#include "libc/errno.h" +#include "libc/time/time.h" /* ** Structure of the fsdir() table-valued function @@ -3074,11 +3065,10 @@ int sqlite3_fileio_init(sqlite3 *db, char **pzErrMsg, ** faster than any human can type. ** */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -3585,10 +3575,10 @@ int sqlite3_completion_init(sqlite3 *db, char **pzErrMsg, ** If the file being opened is a plain database (not an appended one), then ** this shim is a pass-through into the default underlying VFS. (rule 3) **/ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* The append mark at the end of the database is: ** @@ -4188,9 +4178,9 @@ int sqlite3_appendvfs_init(sqlite3 *db, char **pzErrMsg, ** This extension is used to implement the --memtrace option of the ** command-line shell. */ -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" /* The original memory allocation routines */ static sqlite3_mem_methods memtraceBase; @@ -4298,11 +4288,10 @@ int sqlite3MemTraceDeactivate(void) { ** is *not* limited integers that can be expressed as a ** 64-bit machine integer. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* ** Compare text in lexicographic order, except strings of digits @@ -4378,12 +4367,11 @@ int sqlite3_uint_init(sqlite3 *db, char **pzErrMsg, ** ** The focus here is on simplicity and correctness, not performance. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/str/str.h" /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -5053,10 +5041,10 @@ int sqlite3_decimal_init(sqlite3 *db, char **pzErrMsg, ** FROM pow2, c WHERE pow2.x=ieee754_exponent(c.bin); ** */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -5311,10 +5299,10 @@ int sqlite3_ieee_init(sqlite3 *db, char **pzErrMsg, ** encourages the query planner to order joins such that the bounds of the ** series are well-defined. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -5711,12 +5699,12 @@ int sqlite3_series_init(sqlite3 *db, char **pzErrMsg, ** * No support for zip64 extensions ** * Only the "inflate/deflate" (zlib) compression method is supported */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include -#include -#include +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/zlib/zlib.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -7857,10 +7845,10 @@ int sqlite3_zipfile_init(sqlite3 *db, char **pzErrMsg, ** for working with sqlar archives and used by the shell tool's built-in ** sqlar support. */ -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "third_party/zlib/zlib.h" /* ** Implementation of the "sqlar_compress(X)" SQL function. @@ -7974,7 +7962,7 @@ int sqlite3_sqlar_init(sqlite3 *db, char **pzErrMsg, */ #if !defined(SQLITEEXPERT_H) #define SQLITEEXPERT_H 1 -/* #include "sqlite3.h" */ +/* #include "third_party/sqlite3/sqlite3.h" */ typedef struct sqlite3expert sqlite3expert; @@ -8144,10 +8132,10 @@ void sqlite3_expert_destroy(sqlite3expert *); ** ************************************************************************* */ -/* #include "sqlite3expert.h" */ -#include -#include -#include +/* #include "third_party/sqlite3/sqlite3expert.h" */ +#include "libc/assert.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -10107,14 +10095,14 @@ void sqlite3_expert_destroy(sqlite3expert *p) { ** child page in the database. */ #if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ +/* #include "third_party/sqlite3/sqlite3ext.h" */ /* typedef unsigned char u8; */ #endif SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #define DBDATA_PADDING_BYTES 100 @@ -20668,6 +20656,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv) { setBinaryMode(stdin, 0); setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ + setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ); + setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ); stdin_is_interactive = isatty(0); stdout_is_console = isatty(1); diff --git a/third_party/sqlite3/sqlite3.h b/third_party/sqlite3/sqlite3.h index c6d51f875..56b61db2c 100644 --- a/third_party/sqlite3/sqlite3.h +++ b/third_party/sqlite3/sqlite3.h @@ -32,7 +32,7 @@ */ #ifndef SQLITE3_H #define SQLITE3_H -#include /* Needed for the definition of va_list */ +/* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. @@ -9547,7 +9547,7 @@ SQLITE_API int sqlite3_system_errno(sqlite3 *); ** the most recent version. */ typedef struct sqlite3_snapshot { - unsigned char hidden[48]; + unsigned char dummyhidden[48]; } sqlite3_snapshot; /* diff --git a/third_party/sqlite3/sqlite3.mk b/third_party/sqlite3/sqlite3.mk new file mode 100644 index 000000000..fa5279863 --- /dev/null +++ b/third_party/sqlite3/sqlite3.mk @@ -0,0 +1,102 @@ +#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ +#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ + +PKGS += THIRD_PARTY_SQLITE3 + +THIRD_PARTY_SQLITE3_ARTIFACTS += THIRD_PARTY_SQLITE3_A +THIRD_PARTY_SQLITE3 = $(THIRD_PARTY_SQLITE3_A_DEPS) $(THIRD_PARTY_SQLITE3_A) $(THIRD_PARTY_SQLITE3_COMS) +THIRD_PARTY_SQLITE3_A = o/$(MODE)/third_party/sqlite3/libsqlite3.a +THIRD_PARTY_SQLITE3_A_FILES := $(wildcard third_party/sqlite3/*) +THIRD_PARTY_SQLITE3_A_HDRS = $(filter %.h,$(THIRD_PARTY_SQLITE3_A_FILES)) +THIRD_PARTY_SQLITE3_A_SRCS_C = $(filter-out %/geopoly.c,$(filter %.c,$(THIRD_PARTY_SQLITE3_A_FILES))) +THIRD_PARTY_SQLITE3_BINS = $(THIRD_PARTY_SQLITE3_COMS) $(THIRD_PARTY_SQLITE3_COMS:%=%.dbg) + +THIRD_PARTY_SQLITE3_A_SRCS = \ + $(THIRD_PARTY_SQLITE3_A_SRCS_C) + +THIRD_PARTY_SQLITE3_A_OBJS = \ + $(THIRD_PARTY_SQLITE3_A_SRCS_C:%.c=o/$(MODE)/%.o) + +THIRD_PARTY_SQLITE3_COMS = \ + o/$(MODE)/third_party/sqlite3/sqlite3.com + +THIRD_PARTY_SQLITE3_A_CHECKS = \ + $(THIRD_PARTY_SQLITE3_A).pkg \ + $(THIRD_PARTY_SQLITE3_A_HDRS:%=o/$(MODE)/%.ok) + +THIRD_PARTY_SQLITE3_A_DIRECTDEPS = \ + LIBC_ALG \ + LIBC_BITS \ + LIBC_CALLS \ + LIBC_FMT \ + LIBC_INTRIN \ + LIBC_MEM \ + LIBC_NEXGEN32E \ + LIBC_RUNTIME \ + LIBC_STDIO \ + LIBC_STR \ + LIBC_STUBS \ + LIBC_SYSV \ + LIBC_SYSV_CALLS \ + LIBC_TIME \ + LIBC_TINYMATH \ + LIBC_UNICODE \ + THIRD_PARTY_GDTOA \ + THIRD_PARTY_MUSL \ + THIRD_PARTY_ZLIB + +THIRD_PARTY_SQLITE3_A_DEPS := \ + $(call uniq,$(foreach x,$(THIRD_PARTY_SQLITE3_A_DIRECTDEPS),$($(x)))) + +o/$(MODE)/third_party/sqlite3/sqlite3.com.dbg: \ + $(THIRD_PARTY_SQLITE3_A_DEPS) \ + $(THIRD_PARTY_SQLITE3_A) \ + o/$(MODE)/third_party/sqlite3/shell.o \ + $(CRT) \ + $(APE) + -@$(APELINK) + +$(THIRD_PARTY_SQLITE3_A): \ + third_party/sqlite3/ \ + $(THIRD_PARTY_SQLITE3_A).pkg \ + $(filter-out %/shell.o,$(THIRD_PARTY_SQLITE3_A_OBJS)) + +$(THIRD_PARTY_SQLITE3_A).pkg: \ + $(filter-out %/shell.o,$(THIRD_PARTY_SQLITE3_A_OBJS)) \ + $(foreach x,$(THIRD_PARTY_SQLITE3_A_DIRECTDEPS),$($(x)_A).pkg) + +$(THIRD_PARTY_SQLITE3_A_OBJS): \ + OVERRIDE_CFLAGS = \ + -DSTACK_FRAME_UNLIMITED \ + -DSQLITE_CORE \ + -DSQLITE_OS_UNIX=1 \ + -DBUILD_sqlite -DNDEBUG \ + -DSQLITE_THREADSAFE=0 \ + -DSQLITE_OMIT_LOAD_EXTENSION=1 \ + -DSQLITE_ENABLE_MATH_FUNCTIONS \ + -DSQLITE_ENABLE_FTS3 \ + -DSQLITE_ENABLE_FTS4 \ + -DSQLITE_ENABLE_FTS5 \ + -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_ENABLE_GEOPOLY \ + -DSQLITE_ENABLE_RTREE \ + -DSQLITE_ENABLE_SESSION \ + -DSQLITE_ENABLE_PREUPDATE_HOOK \ + -DSQLITE_TEMP_STORE=1 \ + -DHAVE_READLINE=0 \ + -DHAVE_EDITLINE=0 \ + -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_ENABLE_RTREE \ + -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ + -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \ + -DSQLITE_ENABLE_STMTVTAB \ + -DSQLITE_ENABLE_DBPAGE_VTAB \ + -DSQLITE_ENABLE_DBSTAT_VTAB \ + -DSQLITE_ENABLE_BYTECODE_VTAB \ + -DSQLITE_ENABLE_OFFSET_SQL_FUNC \ + -DSQLITE_ENABLE_DESERIALIZE + +.PHONY: o/$(MODE)/third_party/sqlite3 +o/$(MODE)/third_party/sqlite3: \ + $(THIRD_PARTY_SQLITE3_BINS) \ + $(THIRD_PARTY_SQLITE3_CHECKS) diff --git a/third_party/sqlite3/sqlite3ext.h b/third_party/sqlite3/sqlite3ext.h index 8501267a3..4839fcb73 100644 --- a/third_party/sqlite3/sqlite3ext.h +++ b/third_party/sqlite3/sqlite3ext.h @@ -17,7 +17,7 @@ */ #ifndef SQLITE3EXT_H #define SQLITE3EXT_H -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" /* ** The following structure holds pointers to all of the SQLite API diff --git a/third_party/sqlite3/sqlite3rbu.c b/third_party/sqlite3/sqlite3rbu.c index 210275271..fdcc9c3f1 100644 --- a/third_party/sqlite3/sqlite3rbu.c +++ b/third_party/sqlite3/sqlite3rbu.c @@ -80,17 +80,17 @@ ** */ -#include -#include -#include - -#include "sqlite3.h" +#include "libc/assert.h" +#include "libc/calls/calls.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/sqlite3.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) -#include "sqlite3rbu.h" +#include "third_party/sqlite3/sqlite3rbu.h" #if defined(_WIN32_WCE) -#include "windows.h" +#include "third_party/sqlite3/windows.h" #endif /* Maximum number of prepared UPDATE statements held by this module */ diff --git a/third_party/sqlite3/sqlite3rbu.h b/third_party/sqlite3/sqlite3rbu.h index 83661123d..3ffa92793 100644 --- a/third_party/sqlite3/sqlite3rbu.h +++ b/third_party/sqlite3/sqlite3rbu.h @@ -267,7 +267,7 @@ #ifndef _SQLITE3RBU_H #define _SQLITE3RBU_H -#include "sqlite3.h" /* Required for error code definitions */ +#include "third_party/sqlite3/sqlite3.h" /* Required for error code definitions */ #ifdef __cplusplus extern "C" { diff --git a/third_party/sqlite3/sqlite3rtree.h b/third_party/sqlite3/sqlite3rtree.h index 040571eb4..04e65fa88 100644 --- a/third_party/sqlite3/sqlite3rtree.h +++ b/third_party/sqlite3/sqlite3rtree.h @@ -14,7 +14,7 @@ #ifndef _SQLITE3RTREE_H_ #define _SQLITE3RTREE_H_ -#include +#include "third_party/sqlite3/sqlite3.h" #ifdef __cplusplus extern "C" { diff --git a/third_party/sqlite3/sqlite3session.c b/third_party/sqlite3/sqlite3session.c index 65435ec4e..a09b0480c 100644 --- a/third_party/sqlite3/sqlite3session.c +++ b/third_party/sqlite3/sqlite3session.c @@ -1,13 +1,13 @@ #if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK) -#include "sqlite3session.h" +#include "third_party/sqlite3/sqlite3session.h" -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_AMALGAMATION -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" #endif typedef struct SessionTable SessionTable; diff --git a/third_party/sqlite3/sqlite3session.h b/third_party/sqlite3/sqlite3session.h index 63acab132..99576d936 100644 --- a/third_party/sqlite3/sqlite3session.h +++ b/third_party/sqlite3/sqlite3session.h @@ -9,7 +9,7 @@ extern "C" { #endif -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" /* ** CAPI3REF: Session Object Handle diff --git a/third_party/sqlite3/sqliteInt.h b/third_party/sqlite3/sqliteInt.h index ee1047efe..919350842 100644 --- a/third_party/sqlite3/sqliteInt.h +++ b/third_party/sqlite3/sqliteInt.h @@ -56,12 +56,12 @@ ** compiler warnings due to subsequent content in this file and other files ** that are included by this file. */ -#include "msvc.h" +#include "third_party/sqlite3/msvc.h" /* ** Special setup for VxWorks */ -#include "vxworks.h" +#include "third_party/sqlite3/vxworks.h" /* ** These #defines should enable >2GB file support on POSIX if the @@ -165,9 +165,9 @@ ** disabled. */ #if defined(_HAVE_MINGW_H) -#include "mingw.h" +#include "third_party/sqlite3/mingw.h" #elif defined(_HAVE__MINGW_H) -#include "_mingw.h" +#include "third_party/sqlite3/_mingw.h" #endif /* @@ -185,18 +185,18 @@ ** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for ** MinGW. */ -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" /* ** Include the configuration header output by 'configure' if we're using the ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "config.h" +#include "third_party/sqlite3/config.h" #define SQLITECONFIG_H 1 #endif -#include "sqliteLimit.h" +#include "third_party/sqlite3/sqliteLimit.h" /* Disable nuisance warnings on Borland compilers */ #if defined(__BORLANDC__) @@ -227,10 +227,10 @@ ** Include standard header files as necessary */ #ifdef HAVE_STDINT_H -#include +#include "libc/calls/weirdtypes.h" #endif #ifdef HAVE_INTTYPES_H -#include +#include "libc/calls/weirdtypes.h" #endif /* @@ -268,7 +268,7 @@ ** inlined. */ #if defined(__GNUC__) -#define SQLITE_NOINLINE __attribute__((noinline)) +#define SQLITE_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 #define SQLITE_NOINLINE __declspec(noinline) #else @@ -585,14 +585,12 @@ extern int sqlite3OSTrace; #define likely(X) (X) #define unlikely(X) (X) -#include -#include -#include -#include -#include - -#include "hash.h" -#include "parse.h" +#include "libc/assert.h" +#include "libc/mem/mem.h" +#include "libc/stdio/stdio.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/hash.h" +#include "third_party/sqlite3/parse.h" /* ** Use a macro to replace memcpy() if compiled with SQLITE_INLINE_MEMCPY. @@ -1228,18 +1226,19 @@ typedef u64 Bitmask; ** just an array of integers. */ typedef int VList; +typedef u32 Pgno; /* ** Defer sourcing vdbe.h and btree.h until after the "u8" and ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque ** pointer types (i.e. FuncDef) defined above. */ -#include "btree.h" -#include "mutex.h" -#include "os.h" -#include "pager.h" -#include "pcache.h" -#include "vdbe.h" +#include "third_party/sqlite3/btree.h" +#include "third_party/sqlite3/mutex.h" +#include "third_party/sqlite3/os.h" +#include "third_party/sqlite3/pager.h" +#include "third_party/sqlite3/pcache.h" +#include "third_party/sqlite3/vdbe.h" /* The SQLITE_EXTRA_DURABLE compile-time option used to set the default ** synchronous setting to EXTRA. It is no longer supported. @@ -4181,7 +4180,7 @@ int sqlite3CorruptPgnoError(int, Pgno); */ #if !defined(SQLITE_ASCII) || \ (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION)) -#include +#include "libc/str/str.h" #endif /* diff --git a/third_party/sqlite3/sqliteicu.h b/third_party/sqlite3/sqliteicu.h index 8581c981e..cac3d4d85 100644 --- a/third_party/sqlite3/sqliteicu.h +++ b/third_party/sqlite3/sqliteicu.h @@ -13,7 +13,7 @@ ** This header file is used by programs that want to link against the ** ICU extension. All it does is declare the sqlite3IcuInit() interface. */ -#include "sqlite3.h" +#include "third_party/sqlite3/sqlite3.h" #ifdef __cplusplus extern "C" { diff --git a/third_party/sqlite3/status.c b/third_party/sqlite3/status.c index 340d75a61..9d83a74d8 100644 --- a/third_party/sqlite3/status.c +++ b/third_party/sqlite3/status.c @@ -13,8 +13,8 @@ ** This module implements the sqlite3_status() interface and related ** functionality. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* ** Variables in which to record status information. diff --git a/third_party/sqlite3/stmt.c b/third_party/sqlite3/stmt.c index a38f01f5b..60a22422b 100644 --- a/third_party/sqlite3/stmt.c +++ b/third_party/sqlite3/stmt.c @@ -22,11 +22,11 @@ */ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) #if !defined(SQLITEINT_H) -#include "sqlite3ext.h" +#include "third_party/sqlite3/sqlite3ext.h" #endif SQLITE_EXTENSION_INIT1 -#include -#include +#include "libc/assert.h" +#include "libc/str/str.h" #ifndef SQLITE_OMIT_VIRTUALTABLE diff --git a/third_party/sqlite3/table.c b/third_party/sqlite3/table.c index b439bbaf1..c3e199295 100644 --- a/third_party/sqlite3/table.c +++ b/third_party/sqlite3/table.c @@ -16,7 +16,7 @@ ** These routines are in a separate files so that they will not be linked ** if they are not used. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_GET_TABLE diff --git a/third_party/sqlite3/threads.c b/third_party/sqlite3/threads.c index fff28f74c..63a640cf4 100644 --- a/third_party/sqlite3/threads.c +++ b/third_party/sqlite3/threads.c @@ -25,9 +25,9 @@ ** of multiple cores can do so, while also allowing applications to stay ** single-threaded if desired. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if SQLITE_OS_WIN -#include "os_win.h" +#include "third_party/sqlite3/os_win.h" #endif #if SQLITE_MAX_WORKER_THREADS > 0 diff --git a/third_party/sqlite3/tokenize.c b/third_party/sqlite3/tokenize.c index 2730945a3..8b77cbf36 100644 --- a/third_party/sqlite3/tokenize.c +++ b/third_party/sqlite3/tokenize.c @@ -15,9 +15,8 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. */ -#include - -#include "sqliteInt.h" +#include "libc/mem/mem.h" +#include "third_party/sqlite3/sqliteInt.h" /* Character classes for tokenizing ** @@ -625,7 +624,7 @@ const unsigned char ebcdicToAscii[] = { ** named keywordhash.h and then included into this source file by ** the #include below. */ -#include "keywordhash.h" +#include "third_party/sqlite3/keywordhash.h" /* ** If X is a character that can be used in an identifier then diff --git a/third_party/sqlite3/treeview.c b/third_party/sqlite3/treeview.c index 81882af98..0c02fb9bb 100644 --- a/third_party/sqlite3/treeview.c +++ b/third_party/sqlite3/treeview.c @@ -17,7 +17,7 @@ ** The interfaces in this file is only available when compiling ** with SQLITE_DEBUG. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifdef SQLITE_DEBUG /* diff --git a/third_party/sqlite3/trigger.c b/third_party/sqlite3/trigger.c index 6cda57a64..da527d8ca 100644 --- a/third_party/sqlite3/trigger.c +++ b/third_party/sqlite3/trigger.c @@ -10,7 +10,7 @@ ************************************************************************* ** This file contains the implementation for TRIGGERs */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_TRIGGER /* diff --git a/third_party/sqlite3/update.c b/third_party/sqlite3/update.c index f4e0d4f6f..ef2ca0d69 100644 --- a/third_party/sqlite3/update.c +++ b/third_party/sqlite3/update.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_VIRTUALTABLE /* Forward declaration */ diff --git a/third_party/sqlite3/upsert.c b/third_party/sqlite3/upsert.c index 4d34f0904..acc7f32b3 100644 --- a/third_party/sqlite3/upsert.c +++ b/third_party/sqlite3/upsert.c @@ -12,7 +12,7 @@ ** This file contains code to implement various aspects of UPSERT ** processing and handling of the Upsert object. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_UPSERT /* diff --git a/third_party/sqlite3/userauth.c b/third_party/sqlite3/userauth.c index 3b575a40a..884da0580 100644 --- a/third_party/sqlite3/userauth.c +++ b/third_party/sqlite3/userauth.c @@ -23,7 +23,7 @@ */ #ifdef SQLITE_USER_AUTHENTICATION #ifndef SQLITEINT_H -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #endif /* diff --git a/third_party/sqlite3/utf.c b/third_party/sqlite3/utf.c index ae5f6fc2a..f1d9b9dac 100644 --- a/third_party/sqlite3/utf.c +++ b/third_party/sqlite3/utf.c @@ -33,10 +33,9 @@ ** 0xfe 0xff big-endian utf-16 follows ** */ -#include - -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "libc/assert.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" #if !defined(SQLITE_AMALGAMATION) && SQLITE_BYTEORDER == 0 /* diff --git a/third_party/sqlite3/util.c b/third_party/sqlite3/util.c index 7d42ac854..64c091c47 100644 --- a/third_party/sqlite3/util.c +++ b/third_party/sqlite3/util.c @@ -15,11 +15,10 @@ ** strings, and stuff like that. ** */ -#include -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_FLOATING_POINT -#include +#include "libc/math.h" #endif /* diff --git a/third_party/sqlite3/vacuum.c b/third_party/sqlite3/vacuum.c index a3fe36620..753f0d25d 100644 --- a/third_party/sqlite3/vacuum.c +++ b/third_party/sqlite3/vacuum.c @@ -14,8 +14,8 @@ ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" #if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH) diff --git a/third_party/sqlite3/vdbe.c b/third_party/sqlite3/vdbe.c index be7d89f23..ab387a4f5 100644 --- a/third_party/sqlite3/vdbe.c +++ b/third_party/sqlite3/vdbe.c @@ -18,8 +18,8 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* ** Invoke this macro on memory cells just prior to changing the @@ -594,7 +594,7 @@ void sqlite3VdbeRegisterDump(Vdbe *v) { ** hwtime.h contains inline assembler code for implementing ** high-performance timing routines. */ -#include "hwtime.h" +#include "third_party/sqlite3/hwtime.h" #endif diff --git a/third_party/sqlite3/vdbe.h b/third_party/sqlite3/vdbe.h index ea5ba9825..dc6caf24f 100644 --- a/third_party/sqlite3/vdbe.h +++ b/third_party/sqlite3/vdbe.h @@ -17,7 +17,7 @@ */ #ifndef SQLITE_VDBE_H #define SQLITE_VDBE_H -#include +#include "libc/stdio/stdio.h" /* ** A single VDBE is an opaque structure named "Vdbe". Only routines @@ -165,7 +165,7 @@ typedef struct VdbeOpList VdbeOpList; ** The makefile scans the vdbe.c source file and creates the "opcodes.h" ** header file that defines a number for each opcode used by the VDBE. */ -#include "opcodes.h" +#include "third_party/sqlite3/opcodes.h" /* ** Additional non-public SQLITE_PREPARE_* flags diff --git a/third_party/sqlite3/vdbeapi.c b/third_party/sqlite3/vdbeapi.c index 7cdc78332..cf31d0266 100644 --- a/third_party/sqlite3/vdbeapi.c +++ b/third_party/sqlite3/vdbeapi.c @@ -13,8 +13,8 @@ ** This file contains code use to implement APIs that are part of the ** VDBE. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" #ifndef SQLITE_OMIT_DEPRECATED /* diff --git a/third_party/sqlite3/vdbeaux.c b/third_party/sqlite3/vdbeaux.c index 8943f098d..547620eeb 100644 --- a/third_party/sqlite3/vdbeaux.c +++ b/third_party/sqlite3/vdbeaux.c @@ -12,8 +12,8 @@ ** This file contains code used for creating, destroying, and populating ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* Forward references */ static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef); diff --git a/third_party/sqlite3/vdbeblob.c b/third_party/sqlite3/vdbeblob.c index 1ef7d51ba..2b329b935 100644 --- a/third_party/sqlite3/vdbeblob.c +++ b/third_party/sqlite3/vdbeblob.c @@ -13,8 +13,8 @@ ** This file contains code used to implement incremental BLOB I/O. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" #ifndef SQLITE_OMIT_INCRBLOB diff --git a/third_party/sqlite3/vdbemem.c b/third_party/sqlite3/vdbemem.c index 0e496216b..a1a1f4d49 100644 --- a/third_party/sqlite3/vdbemem.c +++ b/third_party/sqlite3/vdbemem.c @@ -15,8 +15,8 @@ ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* True if X is a power of two. 0 is considered a power of two here. ** In other words, return true if X has at most one bit set. diff --git a/third_party/sqlite3/vdbesort.c b/third_party/sqlite3/vdbesort.c index d5dd47536..67f6570da 100644 --- a/third_party/sqlite3/vdbesort.c +++ b/third_party/sqlite3/vdbesort.c @@ -135,8 +135,8 @@ ** thread to merge the output of each of the others to a single PMA for ** the main thread to read from. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* ** If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various diff --git a/third_party/sqlite3/vdbetrace.c b/third_party/sqlite3/vdbetrace.c index e4ea486e7..4db2a8474 100644 --- a/third_party/sqlite3/vdbetrace.c +++ b/third_party/sqlite3/vdbetrace.c @@ -15,8 +15,8 @@ ** ** The Vdbe parse-tree explainer is also found here. */ -#include "sqliteInt.h" -#include "vdbeInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/vdbeInt.h" #ifndef SQLITE_OMIT_TRACE diff --git a/third_party/sqlite3/vdbevtab.c b/third_party/sqlite3/vdbevtab.c index b07b524af..1ff39956e 100644 --- a/third_party/sqlite3/vdbevtab.c +++ b/third_party/sqlite3/vdbevtab.c @@ -13,9 +13,9 @@ ** This file implements virtual-tables for examining the bytecode content ** of a prepared statement. */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #if defined(SQLITE_ENABLE_BYTECODE_VTAB) && !defined(SQLITE_OMIT_VIRTUALTABLE) -#include "vdbeInt.h" +#include "third_party/sqlite3/vdbeInt.h" /* An instance of the bytecode() table-valued function. */ diff --git a/third_party/sqlite3/vtab.c b/third_party/sqlite3/vtab.c index 70c86238a..3e7581f61 100644 --- a/third_party/sqlite3/vtab.c +++ b/third_party/sqlite3/vtab.c @@ -12,7 +12,7 @@ ** This file contains code used to help implement virtual tables. */ #ifndef SQLITE_OMIT_VIRTUALTABLE -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* ** Before a virtual table xCreate() or xConnect() method is invoked, the diff --git a/third_party/sqlite3/wal.c b/third_party/sqlite3/wal.c index 13f5375c4..1591bd0dc 100644 --- a/third_party/sqlite3/wal.c +++ b/third_party/sqlite3/wal.c @@ -246,7 +246,7 @@ */ #ifndef SQLITE_OMIT_WAL -#include "wal.h" +#include "third_party/sqlite3/wal.h" /* ** Trace output macros diff --git a/third_party/sqlite3/wal.h b/third_party/sqlite3/wal.h index 71686ab5a..602b340dc 100644 --- a/third_party/sqlite3/wal.h +++ b/third_party/sqlite3/wal.h @@ -17,7 +17,7 @@ #ifndef SQLITE_WAL_H #define SQLITE_WAL_H -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" /* Macros for extracting appropriate sync flags for either transaction ** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)): diff --git a/third_party/sqlite3/walker.c b/third_party/sqlite3/walker.c index 415479f77..54f09ba74 100644 --- a/third_party/sqlite3/walker.c +++ b/third_party/sqlite3/walker.c @@ -12,10 +12,9 @@ ** This file contains routines used for walking the parser tree for ** an SQL statement. */ -#include -#include - -#include "sqliteInt.h" +#include "libc/mem/mem.h" +#include "libc/str/str.h" +#include "third_party/sqlite3/sqliteInt.h" #if !defined(SQLITE_OMIT_WINDOWFUNC) /* diff --git a/third_party/sqlite3/where.c b/third_party/sqlite3/where.c index cbf3fdef9..901d2cd0f 100644 --- a/third_party/sqlite3/where.c +++ b/third_party/sqlite3/where.c @@ -16,8 +16,8 @@ ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". */ -#include "sqliteInt.h" -#include "whereInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/whereInt.h" /* ** Extra information appended to the end of sqlite3_index_info but not diff --git a/third_party/sqlite3/wherecode.c b/third_party/sqlite3/wherecode.c index 7cfa67e32..0de89cd9b 100644 --- a/third_party/sqlite3/wherecode.c +++ b/third_party/sqlite3/wherecode.c @@ -17,8 +17,8 @@ ** that actually generate the bulk of the WHERE loop code. The original where.c ** file retains the code that does query planning and analysis. */ -#include "sqliteInt.h" -#include "whereInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/whereInt.h" #ifndef SQLITE_OMIT_EXPLAIN diff --git a/third_party/sqlite3/whereexpr.c b/third_party/sqlite3/whereexpr.c index ccee683e3..fb91233f0 100644 --- a/third_party/sqlite3/whereexpr.c +++ b/third_party/sqlite3/whereexpr.c @@ -16,8 +16,8 @@ ** readability and editabiliity. This file contains utility routines for ** analyzing Expr objects in the WHERE clause. */ -#include "sqliteInt.h" -#include "whereInt.h" +#include "third_party/sqlite3/sqliteInt.h" +#include "third_party/sqlite3/whereInt.h" /* Forward declarations */ static void exprAnalyze(SrcList *, WhereClause *, int); diff --git a/third_party/sqlite3/window.c b/third_party/sqlite3/window.c index 95b8f90a6..ab9b06637 100644 --- a/third_party/sqlite3/window.c +++ b/third_party/sqlite3/window.c @@ -10,7 +10,7 @@ ** ************************************************************************* */ -#include "sqliteInt.h" +#include "third_party/sqlite3/sqliteInt.h" #ifndef SQLITE_OMIT_WINDOWFUNC