Replaces use of deprecated WINAPI_FAMILY_APP macro with WINAPI_FAMILY_PC_APP
[sqlcipher.git] / src / mem0.c
blob0d0b6667d60a955a0696df6289b49178969343aa
1 /*
2 ** 2008 October 28
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
6 **
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
11 *************************************************************************
13 ** This file contains a no-op memory allocation drivers for use when
14 ** SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented
15 ** here always fail. SQLite will not operate with these drivers. These
16 ** are merely placeholders. Real drivers must be substituted using
17 ** sqlite3_config() before SQLite will operate.
19 #include "sqliteInt.h"
22 ** This version of the memory allocator is the default. It is
23 ** used when no other memory allocator is specified using compile-time
24 ** macros.
26 #ifdef SQLITE_ZERO_MALLOC
29 ** No-op versions of all memory allocation routines
31 static void *sqlite3MemMalloc(int nByte){ return 0; }
32 static void sqlite3MemFree(void *pPrior){ return; }
33 static void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; }
34 static int sqlite3MemSize(void *pPrior){ return 0; }
35 static int sqlite3MemRoundup(int n){ return n; }
36 static int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; }
37 static void sqlite3MemShutdown(void *NotUsed){ return; }
40 ** This routine is the only routine in this file with external linkage.
42 ** Populate the low-level memory allocation function pointers in
43 ** sqlite3GlobalConfig.m with pointers to the routines in this file.
45 void sqlite3MemSetDefault(void){
46 static const sqlite3_mem_methods defaultMethods = {
47 sqlite3MemMalloc,
48 sqlite3MemFree,
49 sqlite3MemRealloc,
50 sqlite3MemSize,
51 sqlite3MemRoundup,
52 sqlite3MemInit,
53 sqlite3MemShutdown,
56 sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);
59 #endif /* SQLITE_ZERO_MALLOC */