SQLITE源码剖析(3)
程序员文章站
2022-03-02 16:28:01
...
声明:本SQLite源码剖析系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载
/* ** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1. ** It determines whether or not the features related to ** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can ** be overridden at runtime using the sqlite3_config() API. */ // SQLITE_DEFAULT_MEMSTATUS宏被定义为0或1,在运行时可使 //用sqlite3_config() API修改该值 #if !defined(SQLITE_DEFAULT_MEMSTATUS) # define SQLITE_DEFAULT_MEMSTATUS 1 #endif /* ** Exactly one of the following macros must be defined in order to ** specify which memory allocation subsystem to use. **该宏不一定要被定义,使用SQLITE_SYSTEM_MALLOC标准内存分配系统malloc()还是malloc()的SQLITE_MEMDEBUG调试版本 ** SQLITE_SYSTEM_MALLOC // Use normal system malloc() ** SQLITE_MEMDEBUG // Debugging version of system malloc() ** ** (Historical note: There used to be several other options, but we've ** pared it down to just these two.) ** ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as ** the default. */ //SQLITE_SYSTEM_MALLOC和SQLITE_MEMDEBUG不能同时被定义 #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)>1 # error "At most one of the following compile-time configuration options\ is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG" #endif //默认使用SQLITE_SYSTEM_MALLOC标准 #if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)==0 # define SQLITE_SYSTEM_MALLOC 1 #endif /* ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the ** sizes of memory allocations below this value where possible. */ // SQLITE_MALLOC_SOFT_LIMIT非0,则试图把分配的内存控制在这些值以内 #if !defined(SQLITE_MALLOC_SOFT_LIMIT) # define SQLITE_MALLOC_SOFT_LIMIT 1024 #endif /* ** We need to define _XOPEN_SOURCE as follows in order to enable ** recursive mutexes on most Unix systems. But Mac OS X is different. ** The _XOPEN_SOURCE define causes problems for Mac OS X we are told, ** so it is omitted there. See ticket #2673. **, ** Later we learn that _XOPEN_SOURCE is poorly or incorrectly ** implemented on some systems. So we avoid defining it at all ** if it is already defined or if it is unneeded because we are ** not doing a threadsafe build. Ticket #2681. ** ** See also ticket #2741. */ //在大多数UNIX系统中,我们需要定义_XOPEN_SOURCE允许递归互斥 //对于Mac OS X, _XOPEN_SOURCE导致一些问题发生 #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ #endif /* ** The TCL headers are only needed when compiling the TCL bindings. **TCL(Tool Command Language)是一种解释执行的脚本语言。具有良好的跨平台特性和**可扩展性,TCL本身是用C语言实现的,可以很方便的通过C语言进行扩充,增加新的**命令,也可以很方便的把TCL解释器嵌入你的程序中。TCL解释器也是公开源代码的。 **当编译TCL绑定时,才需要TCL头文件 */ //如果需要绑定TCL,则包括tcl.h #if defined(SQLITE_TCL) || defined(TCLSH) # include <tcl.h> #endif