00001 /* 00002 ** 2008 October 28 00003 ** 00004 ** The author disclaims copyright to this source code. In place of 00005 ** a legal notice, here is a blessing: 00006 ** 00007 ** May you do good and not evil. 00008 ** May you find forgiveness for yourself and forgive others. 00009 ** May you share freely, never taking more than you give. 00010 ** 00011 ************************************************************************* 00012 ** 00013 ** This file contains a no-op memory allocation drivers for use when 00014 ** SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented 00015 ** here always fail. SQLite will not operate with these drivers. These 00016 ** are merely placeholders. Real drivers must be substituted using 00017 ** sqlite3_config() before SQLite will operate. 00018 ** 00019 ** $Id: mem0.c,v 1.1 2008/10/28 18:58:20 drh Exp $ 00020 */ 00021 #include "sqliteInt.h" 00022 00023 /* 00024 ** This version of the memory allocator is the default. It is 00025 ** used when no other memory allocator is specified using compile-time 00026 ** macros. 00027 */ 00028 #ifdef SQLITE_ZERO_MALLOC 00029 00030 /* 00031 ** No-op versions of all memory allocation routines 00032 */ 00033 static void *sqlite3MemMalloc(int nByte){ return 0; } 00034 static void sqlite3MemFree(void *pPrior){ return; } 00035 static void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; } 00036 static int sqlite3MemSize(void *pPrior){ return 0; } 00037 static int sqlite3MemRoundup(int n){ return n; } 00038 static int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; } 00039 static void sqlite3MemShutdown(void *NotUsed){ return; } 00040 00041 /* 00042 ** This routine is the only routine in this file with external linkage. 00043 ** 00044 ** Populate the low-level memory allocation function pointers in 00045 ** sqlite3GlobalConfig.m with pointers to the routines in this file. 00046 */ 00047 void sqlite3MemSetDefault(void){ 00048 static const sqlite3_mem_methods defaultMethods = { 00049 sqlite3MemMalloc, 00050 sqlite3MemFree, 00051 sqlite3MemRealloc, 00052 sqlite3MemSize, 00053 sqlite3MemRoundup, 00054 sqlite3MemInit, 00055 sqlite3MemShutdown, 00056 0 00057 }; 00058 sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); 00059 } 00060 00061 #endif /* SQLITE_ZERO_MALLOC */
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:55 2011 by Doxygen 1.6.1