復制代碼 代碼如下:
typedef union _zvalue_value {
long lval; /* long value */
double dval; /* double value */
struct {
char *val;
int len;
} str;
HashTable *ht; /* hash table value */
zend_object_value obj;
} zvalue_value;
struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
zend_uint refcount;
zend_uchar type; /* active type */
zend_uchar is_ref;
};
typedef struct _zval_struct zval;
<span></span>Zend根據(jù)type值來決定訪問value的哪個成員,可用值如下:
復制代碼 代碼如下:
typedef struct bucket {
ulong h; // 存放hash
uint nKeyLength;
void *pData; // 指向value,是用戶數(shù)據(jù)的副本
void *pDataPtr;
struct bucket *pListNext; // pListNext和pListLast組成
struct bucket *pListLast; // 整個HashTable的雙鏈表
struct bucket *pNext; // pNext和pLast用于組成某個hash對應
struct bucket *pLast; // 的雙鏈表
char arKey[1]; // key
} Bucket;
typedef struct _hashtable {
uint nTableSize;
uint nTableMask;
uint nNumOfElements;
ulong nNextFreeElement;
Bucket *pInternalPointer; /* Used for element traversal */
Bucket *pListHead;
Bucket *pListTail;
Bucket **arBuckets; // hash數(shù)組
dtor_func_t pDestructor; // HashTable初始化時指定,銷毀Bucket時調(diào)用
zend_bool persistent; // 是否采用C的內(nèi)存分配例程
unsigned char nApplyCount;
zend_bool bApplyProtection;
#if ZEND_DEBUG
int inconsistent;
#endif
} HashTable;
新聞熱點
疑難解答