cvs: ZendEngine2 / zend_hash.c zend_hash.h zend_unicode.h

From: Date: Fri, 20 Oct 2006 10:33:32 +0000
Subject: cvs: ZendEngine2 / zend_hash.c zend_hash.h zend_unicode.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5351@lists.php.net to get a copy of this message
tony2001 Fri Oct 20 10:33:32 2006 UTC Modified files: /ZendEngine2 zend_hash.c zend_hash.h zend_unicode.h Log: rename REAL_KEY_SIZE() to USTR_BYTES() and move to zend_unicode.h this macro is going to be actively used in Unicode version of OCI8 (and other extensions, probably) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_hash.c?r1=1.139&r2=1.140&diff_format=u Index: ZendEngine2/zend_hash.c diff -u ZendEngine2/zend_hash.c:1.139 ZendEngine2/zend_hash.c:1.140 --- ZendEngine2/zend_hash.c:1.139 Sat Oct 7 17:34:19 2006 +++ ZendEngine2/zend_hash.c Fri Oct 20 10:33:31 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.139 2006/10/07 17:34:19 andrei Exp $ */ +/* $Id: zend_hash.c,v 1.140 2006/10/20 10:33:31 tony2001 Exp $ */ #include "zend.h" #include "zend_operators.h" @@ -246,7 +246,7 @@ } UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); h = zend_u_inline_hash_func(type, arKey, nKeyLength); nIndex = h & ht->nTableMask; @@ -399,7 +399,7 @@ UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); h = zend_u_inline_hash_func(IS_UNICODE, arKey, nKeyLength); } - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); nIndex = h & ht->nTableMask; @@ -606,7 +606,7 @@ if (flag == HASH_DEL_KEY) { UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); h = zend_u_inline_hash_func(type, arKey, nKeyLength); } nIndex = h & ht->nTableMask; @@ -1081,7 +1081,7 @@ IS_CONSISTENT(ht); UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); h = zend_u_inline_hash_func(type, arKey, nKeyLength); nIndex = h & ht->nTableMask; @@ -1189,7 +1189,7 @@ UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); h = zend_u_inline_hash_func(IS_UNICODE, arKey, nKeyLength); } - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); nIndex = h & ht->nTableMask; @@ -1225,7 +1225,7 @@ IS_CONSISTENT(ht); UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); h = zend_u_inline_hash_func(type, arKey, nKeyLength); nIndex = h & ht->nTableMask; @@ -1332,7 +1332,7 @@ UNICODE_KEY(ht, type, arKey, nKeyLength, tmp); h = zend_u_inline_hash_func(type, arKey, nKeyLength); } - realKeyLength = REAL_KEY_SIZE(type, nKeyLength); + realKeyLength = USTR_BYTES(type, nKeyLength); nIndex = h & ht->nTableMask; @@ -1748,7 +1748,7 @@ result = p1->nKeyLength - p2->nKeyLength; } if (result==0) { - result = memcmp(p1->key.arKey.s, p2->key.arKey.s, REAL_KEY_SIZE(p1->key.type, p1->nKeyLength)); + result = memcmp(p1->key.arKey.s, p2->key.arKey.s, USTR_BYTES(p1->key.type, p1->nKeyLength)); } if (result!=0) { HASH_UNPROTECT_RECURSION(ht1); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_hash.h?r1=1.87&r2=1.88&diff_format=u Index: ZendEngine2/zend_hash.h diff -u ZendEngine2/zend_hash.h:1.87 ZendEngine2/zend_hash.h:1.88 --- ZendEngine2/zend_hash.h:1.87 Sat Oct 7 17:34:19 2006 +++ ZendEngine2/zend_hash.h Fri Oct 20 10:33:31 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.h,v 1.87 2006/10/07 17:34:19 andrei Exp $ */ +/* $Id: zend_hash.h,v 1.88 2006/10/20 10:33:31 tony2001 Exp $ */ #ifndef ZEND_HASH_H #define ZEND_HASH_H @@ -37,8 +37,6 @@ #define HASH_DEL_KEY 0 #define HASH_DEL_INDEX 1 -#define REAL_KEY_SIZE(type, nKeyLength) \ - ((type == IS_UNICODE)?UBYTES(nKeyLength):nKeyLength) typedef ulong (*hash_func_t)(char *arKey, uint nKeyLength); @@ -336,7 +334,7 @@ } #define zend_u_inline_hash_func(type, arKey, nKeyLength) \ - zend_inline_hash_func(arKey.s, REAL_KEY_SIZE(type, nKeyLength)) + zend_inline_hash_func(arKey.s, USTR_BYTES(type, nKeyLength)) ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength); ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_unicode.h?r1=1.22&r2=1.23&diff_format=u Index: ZendEngine2/zend_unicode.h diff -u ZendEngine2/zend_unicode.h:1.22 ZendEngine2/zend_unicode.h:1.23 --- ZendEngine2/zend_unicode.h:1.22 Tue Aug 8 17:36:20 2006 +++ ZendEngine2/zend_unicode.h Fri Oct 20 10:33:31 2006 @@ -136,6 +136,9 @@ #define USTR_LEN(str) (UG(unicode)?u_strlen((str).u):strlen((str).s)) #define USTR_VAL(str) (UG(unicode)?(str).u:(str).s) +#define USTR_BYTES(__type, __length) \ + ((__type == IS_UNICODE)?UBYTES(__length):__length) + #define USTR_MAKE(cs) zend_ascii_to_unicode(cs, sizeof(cs) ZEND_FILE_LINE_CC) #define USTR_MAKE_REL(cs) zend_ascii_to_unicode(cs, sizeof(cs) ZEND_FILE_LINE_RELAY_CC) static inline UChar* zend_ascii_to_unicode(const char *cs, size_t cs_size ZEND_FILE_LINE_DC)

« previous php.zend-engine.cvs (#5351) next »