aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: 4fe3ac4dd34c17363e145fc8261efd496a7f623b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2017 The Sqlite Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// SQLite Is Public Domain

// +build ignore

#define minAlloc (2<<5)

#include <sqlite3.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
	init(-1);
}

int init(int heapSize)
{
	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;
}