aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..50d19fd
--- /dev/null
+++ b/main.c
@@ -0,0 +1,62 @@
+// +build ignore
+
+// SQLite Is Public Domain
+//
+// All of the code and documentation in SQLite has been dedicated to the public
+// domain by the authors. All code authors, and representatives of the
+// companies they work for, have signed affidavits dedicating their
+// contributions to the public domain and originals of those signed affidavits
+// are stored in a firesafe at the main offices of Hwaci. Anyone is free to
+// copy, modify, publish, use, compile, sell, or distribute the original SQLite
+// code, either in source code form or as a compiled binary, for any purpose,
+// commercial or non-commercial, and by any means.
+//
+// The previous paragraph applies to the deliverable code and documentation in
+// SQLite - those parts of the SQLite library that you actually bundle and ship
+// with a larger application. Some scripts used as part of the build process
+// (for example the "configure" scripts generated by autoconf) might fall under
+// other open-source licenses. Nothing from these build scripts ever reaches
+// the final deliverable SQLite library, however, and so the licenses
+// associated with those scripts should not be a factor in assessing your
+// rights to copy and use the SQLite library.
+//
+// All of the deliverable code in SQLite has been written from scratch. No code
+// has been taken from other projects or from the open internet. Every line of
+// code can be traced back to its original author, and all of those authors
+// have public domain dedications on file. So the SQLite code base is clean and
+// is uncontaminated with licensed code from other projects.
+
+#define minAlloc (2<<5)
+
+#include <sqlite3.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ if (argc != 2) {
+ return 1;
+ }
+
+ int heapSize = 0;
+ char *p = argv[1];
+ for (; *p; p++) {
+ heapSize = 10 * heapSize + *p - '0';
+ }
+
+ void *heap = malloc(heapSize);
+ if (heap == 0) {
+ return 1;
+ }
+
+ int rc = sqlite3_config(SQLITE_CONFIG_HEAP, heap, heapSize, minAlloc);
+ if (rc) {
+ return 2;
+ }
+
+ rc = sqlite3_threadsafe();
+ if (!rc) {
+ return 3;
+ }
+
+ return 0;
+}