diff --git a/internal/vfs/tests/mptest/testdata/main.c b/internal/vfs/tests/mptest/testdata/main.c index 028247d..a54fe90 100644 --- a/internal/vfs/tests/mptest/testdata/main.c +++ b/internal/vfs/tests/mptest/testdata/main.c @@ -1,11 +1,12 @@ #include #include +// Configuration #include "sqlite_cfg.h" -// +// Amalgamation #include "sqlite3.c" -// -#include "os.c" +// VFS +#include "vfs.c" sqlite3_destructor_type malloc_destructor = &free; size_t sqlite3_interrupt_offset = offsetof(sqlite3, u1.isInterrupted); diff --git a/internal/vfs/tests/speedtest1/testdata/main.c b/internal/vfs/tests/speedtest1/testdata/main.c index 64831ac..44b6eee 100644 --- a/internal/vfs/tests/speedtest1/testdata/main.c +++ b/internal/vfs/tests/speedtest1/testdata/main.c @@ -1,11 +1,12 @@ #include #include +// Configuration #include "sqlite_cfg.h" -// +// Amalgamation #include "sqlite3.c" -// -#include "os.c" +// VFS +#include "vfs.c" sqlite3_destructor_type malloc_destructor = &free; size_t sqlite3_interrupt_offset = offsetof(sqlite3, u1.isInterrupted); diff --git a/sqlite3/main.c b/sqlite3/main.c index 4c9dbc7..ef90dfb 100644 --- a/sqlite3/main.c +++ b/sqlite3/main.c @@ -1,12 +1,13 @@ #include #include +// Configuration #include "sqlite_cfg.h" -// +// Amalgamation #include "sqlite3.c" -// -#include "os.c" -// +// VFS +#include "vfs.c" +// Extensions #include "ext/base64.c" #include "ext/decimal.c" #include "ext/regexp.c" diff --git a/sqlite3/sqlite_cfg.h b/sqlite3/sqlite_cfg.h index 8f445fb..34fd489 100644 --- a/sqlite3/sqlite_cfg.h +++ b/sqlite3/sqlite_cfg.h @@ -40,7 +40,7 @@ #define SQLITE_DEFAULT_LOCKING_MODE 1 #endif -// Recommended Extensions +// Amalgamated Extensions #define SQLITE_ENABLE_MATH_FUNCTIONS 1 #define SQLITE_ENABLE_JSON1 1 @@ -55,5 +55,13 @@ // #define SQLITE_ENABLE_SESSION // #define SQLITE_ENABLE_PREUPDATE_HOOK -// Implemented in os.c. +// https://stackoverflow.com/a/50616684 +#define SECOND(...) SECOND_I(__VA_ARGS__,,) +#define SECOND_I(A,B,...) B +#define GLUE(A,B) GLUE_I(A,B) +#define GLUE_I(A,B) A##B +#define REPLACE_DEFAULT(a, prefix) SECOND(GLUE(prefix, __LINE__), a) +#define REPLACE_AT_LINE(a) ,a + +// Implemented in vfs.c. int localtime_s(struct tm *const pTm, time_t const *const pTime); \ No newline at end of file diff --git a/sqlite3/os.c b/sqlite3/vfs.c similarity index 100% rename from sqlite3/os.c rename to sqlite3/vfs.c