SQLITE源码剖析(3)

 声明:本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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值