CVS update: php3
| From: | zeev | Date: | Sat, 19 Sep 1998 20:17:30 +0000 |
| Subject: | CVS update: php3 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1279@lists.php.net to get a copy of this message | ||
Date: Saturday September 19, 1998 @ 16:17
Author: zeev
Update of /repository/php3
In directory asf:/u2/tmp/cvs-serv184
Modified Files:
acconfig.h config.h.in configure.in php3_hash.c php3_hash.h
Log Message:
Use long's for hash values. Should fix various problems with 64-bit platforms
Index: php3/acconfig.h
diff -c php3/acconfig.h:1.64 php3/acconfig.h:1.65
*** php3/acconfig.h:1.64 Fri Sep 18 12:54:58 1998
--- php3/acconfig.h Sat Sep 19 16:17:28 1998
***************
*** 10,15 ****
--- 10,18 ----
/* define uint by configure if it is missed (QNX and BSD derived) */
#undef uint
+ /* define ulong by configure if it is missed (most probably is) */
+ #undef ulong
+
/* type check for in_addr_t */
#undef in_addr_t
Index: php3/config.h.in
diff -c php3/config.h.in:1.114 php3/config.h.in:1.115
*** php3/config.h.in:1.114 Fri Sep 18 12:54:58 1998
--- php3/config.h.in Sat Sep 19 16:17:28 1998
***************
*** 77,82 ****
--- 77,85 ----
/* define uint by configure if it is missed (QNX and BSD derived) */
#undef uint
+ /* define ulong by configure if it is missed (most probably is) */
+ #undef ulong
+
/* type check for in_addr_t */
#undef in_addr_t
Index: php3/configure.in
diff -c php3/configure.in:1.246 php3/configure.in:1.247
*** php3/configure.in:1.246 Fri Sep 18 12:54:59 1998
--- php3/configure.in Sat Sep 19 16:17:29 1998
***************
*** 1,4 ****
! dnl $Id: configure.in,v 1.246 1998/09/18 16:54:59 rasmus Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(main.c)
--- 1,4 ----
! dnl $Id: configure.in,v 1.247 1998/09/19 20:17:29 zeev Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(main.c)
***************
*** 169,174 ****
--- 169,175 ----
AC_TYPE_UID_T
dnl This is required for QNX and may be some BSD derived systems
AC_CHECK_TYPE( uint, unsigned int )
+ AC_CHECK_TYPE( ulong, unsigned long )
dnl Checks for library functions.
AC_FUNC_VPRINTF
Index: php3/php3_hash.c
diff -c php3/php3_hash.c:1.4 php3/php3_hash.c:1.5
*** php3/php3_hash.c:1.4 Sun Jul 26 09:59:49 1998
--- php3/php3_hash.c Sat Sep 19 16:17:29 1998
***************
*** 29,35 ****
*/
! /* $Id: php3_hash.c,v 1.4 1998/07/26 13:59:49 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 29,35 ----
*/
! /* $Id: php3_hash.c,v 1.5 1998/09/19 20:17:29 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 50,56 ****
\
if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index
*/ \
char *end=tmp+length-1; \
! long idx; \
\
if (*tmp++=='0' && length>2) { /* don't accept numbers with leading
zeros */ \
break; \
--- 50,56 ----
\
if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index
*/ \
char *end=tmp+length-1; \
! ulong idx; \
\
if (*tmp++=='0' && length>2) { /* don't accept numbers with leading
zeros */ \
break; \
***************
*** 71,84 ****
}
/* Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */
! uint PrimeNumbers[] =
{5, 11, 19, 53, 107, 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521,
1048793, 2097397, 4194103, 8388857, 16777447, 33554201, 67108961, 134217487, 268435697, 536870683,
1073741621, 2147483399};
! uint nNumPrimeNumbers = sizeof(PrimeNumbers) / sizeof(uint);
! static uint hashpjw(char *arKey, uint nKeyLength)
{
! uint h = 0, g;
char *arEnd=arKey+nKeyLength;
while (arKey < arEnd) {
--- 71,84 ----
}
/* Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */
! ulong PrimeNumbers[] =
{5, 11, 19, 53, 107, 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521,
1048793, 2097397, 4194103, 8388857, 16777447, 33554201, 67108961, 134217487, 268435697, 536870683,
1073741621, 2147483399};
! uint nNumPrimeNumbers = sizeof(PrimeNumbers) / sizeof(ulong);
! static ulong hashpjw(char *arKey, uint nKeyLength)
{
! ulong h = 0, g;
char *arEnd=arKey+nKeyLength;
while (arKey < arEnd) {
***************
*** 91,97 ****
return h;
}
! PHPAPI int _php3_hash_init(HashTable *ht, uint nSize, uint(*pHashFunction) (char *arKey, uint
nKeyLength), void (*pDestructor) (void *pData),int persistent)
{
uint i;
--- 91,97 ----
return h;
}
! PHPAPI int _php3_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint
nKeyLength), void (*pDestructor) (void *pData),int persistent)
{
uint i;
***************
*** 131,137 ****
PHPAPI int _php3_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint
nDataSize, void **pDest, int flag)
{
! uint h, nIndex;
Bucket *p;
#if DEBUG
TLS_VARS;
--- 131,138 ----
PHPAPI int _php3_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint
nDataSize, void **pDest, int flag)
{
! ulong h;
! uint nIndex;
Bucket *p;
#if DEBUG
TLS_VARS;
***************
*** 227,233 ****
}
! PHPAPI int _php3_hash_index_update_or_next_insert(HashTable *ht, uint h, void *pData, uint
nDataSize, void **pDest, int flag)
{
uint nIndex;
Bucket *p;
--- 228,234 ----
}
! PHPAPI int _php3_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint
nDataSize, void **pDest, int flag)
{
uint nIndex;
Bucket *p;
***************
*** 315,321 ****
PHPAPI int _php3_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData)
{
! uint h, nIndex;
Bucket *p;
#if DEBUG
TLS_VARS;
--- 316,323 ----
PHPAPI int _php3_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData)
{
! ulong h;
! uint nIndex;
Bucket *p;
#if DEBUG
TLS_VARS;
***************
*** 399,405 ****
}
! PHPAPI int _php3_hash_pointer_index_update_or_next_insert(HashTable *ht, uint h, void *pData, int
flag)
{
uint nIndex;
Bucket *p;
--- 401,407 ----
}
! PHPAPI int _php3_hash_pointer_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, int
flag)
{
uint nIndex;
Bucket *p;
***************
*** 480,486 ****
PHPAPI int _php3_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength)
{
! uint h, nIndex;
Bucket *p;
#if DEBUG
TLS_VARS;
--- 482,489 ----
PHPAPI int _php3_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength)
{
! ulong h;
! uint nIndex;
Bucket *p;
#if DEBUG
TLS_VARS;
***************
*** 510,518 ****
return 0;
}
! PHPAPI int _php3_hash_index_is_pointer(HashTable *ht, uint h)
{
-
uint nIndex;
Bucket *p;
--- 513,520 ----
return 0;
}
! PHPAPI int _php3_hash_index_is_pointer(HashTable *ht, ulong h)
{
uint nIndex;
Bucket *p;
***************
*** 566,572 ****
return SUCCESS;
}
! PHPAPI int _php3_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, uint h, int
flag)
{
uint nIndex;
Bucket *p, *t = NULL; /* initialize just to shut gcc up with -Wall */
--- 568,574 ----
return SUCCESS;
}
! PHPAPI int _php3_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int
flag)
{
uint nIndex;
Bucket *p, *t = NULL; /* initialize just to shut gcc up with -Wall */
***************
*** 825,831 ****
*/
PHPAPI int _php3_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
{
! uint h, nIndex;
Bucket *p;
HANDLE_NUMERIC(arKey, nKeyLength, _php3_hash_index_find(ht,idx,pData));
--- 827,834 ----
*/
PHPAPI int _php3_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
{
! ulong h;
! uint nIndex;
Bucket *p;
HANDLE_NUMERIC(arKey, nKeyLength, _php3_hash_index_find(ht,idx,pData));
***************
*** 848,854 ****
PHPAPI int _php3_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
{
! uint h, nIndex;
Bucket *p;
HANDLE_NUMERIC(arKey, nKeyLength, _php3_hash_index_exists(ht,idx));
--- 851,858 ----
PHPAPI int _php3_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
{
! ulong h;
! uint nIndex;
Bucket *p;
HANDLE_NUMERIC(arKey, nKeyLength, _php3_hash_index_exists(ht,idx));
***************
*** 869,875 ****
}
! PHPAPI int _php3_hash_index_find(HashTable *ht, uint h, void **pData)
{
uint nIndex;
Bucket *p;
--- 873,879 ----
}
! PHPAPI int _php3_hash_index_find(HashTable *ht, ulong h, void **pData)
{
uint nIndex;
Bucket *p;
***************
*** 888,894 ****
}
! PHPAPI int _php3_hash_index_exists(HashTable *ht, uint h)
{
uint nIndex;
Bucket *p;
--- 892,898 ----
}
! PHPAPI int _php3_hash_index_exists(HashTable *ht, ulong h)
{
uint nIndex;
Bucket *p;
***************
*** 1056,1062 ****
return SUCCESS;
}
! PHPAPI uint _php3_hash_next_free_element(HashTable *ht)
{
return ht->nNextFreeElement;
--- 1060,1066 ----
return SUCCESS;
}
! PHPAPI ulong _php3_hash_next_free_element(HashTable *ht)
{
return ht->nNextFreeElement;
***************
*** 1085,1091 ****
php3_printf("%s <==> 0x%X\n", p->arKey, p->h);
p = p->pNext;
}
-
}
p = ht->pListTail;
--- 1089,1094 ----
Index: php3/php3_hash.h
diff -c php3/php3_hash.h:1.4 php3/php3_hash.h:1.5
*** php3/php3_hash.h:1.4 Sun Jul 26 09:59:49 1998
--- php3/php3_hash.h Sat Sep 19 16:17:30 1998
***************
*** 29,35 ****
*/
! /* $Id: php3_hash.h,v 1.4 1998/07/26 13:59:49 rasmus Exp $ */
#ifndef _HASH_
--- 29,35 ----
*/
! /* $Id: php3_hash.h,v 1.5 1998/09/19 20:17:30 zeev Exp $ */
#ifndef _HASH_
***************
*** 51,57 ****
struct hashtable;
typedef struct bucket {
! uint h; /* Used for numeric indexing */
char *arKey;
uint nKeyLength;
void *pData;
--- 51,57 ----
struct hashtable;
typedef struct bucket {
! ulong h; /* Used for numeric indexing */
char *arKey;
uint nKeyLength;
void *pData;
***************
*** 65,72 ****
uint nTableSize;
uint nHashSizeIndex;
uint nNumOfElements;
! uint nNextFreeElement;
! uint(*pHashFunction) (char *arKey, uint nKeyLength);
Bucket *pInternalPointer; /* Used for element traversal */
Bucket *pListHead;
Bucket *pListTail;
--- 65,72 ----
uint nTableSize;
uint nHashSizeIndex;
uint nNumOfElements;
! ulong nNextFreeElement;
! ulong(*pHashFunction) (char *arKey, uint nKeyLength);
Bucket *pInternalPointer; /* Used for element traversal */
Bucket *pListHead;
Bucket *pListTail;
***************
*** 77,83 ****
/* startup/shutdown */
! extern PHPAPI int _php3_hash_init(HashTable *ht, uint nSize, uint(*pHashFunction) (char *arKey,
uint nKeyLength), void (*pDestructor) (void *pData), int persistent);
extern PHPAPI void _php3_hash_destroy(HashTable *ht);
/* additions/updates/changes */
--- 77,83 ----
/* startup/shutdown */
! extern PHPAPI int _php3_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey,
uint nKeyLength), void (*pDestructor) (void *pData), int persistent);
extern PHPAPI void _php3_hash_destroy(HashTable *ht);
/* additions/updates/changes */
***************
*** 87,93 ****
#define _php3_hash_add(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
_php3_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_ADD)
! extern PHPAPI int _php3_hash_index_update_or_next_insert(HashTable *ht, uint h, void *pData, uint
nDataSize, void **pDest, int flag);
#define _php3_hash_index_update(ht,h,pData,nDataSize,pDest) \
_php3_hash_index_update_or_next_insert(ht,h,pData,nDataSize,pDest,HASH_UPDATE)
#define _php3_hash_next_index_insert(ht,pData,nDataSize,pDest) \
--- 87,93 ----
#define _php3_hash_add(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
_php3_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_ADD)
! extern PHPAPI int _php3_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint
nDataSize, void **pDest, int flag);
#define _php3_hash_index_update(ht,h,pData,nDataSize,pDest) \
_php3_hash_index_update_or_next_insert(ht,h,pData,nDataSize,pDest,HASH_UPDATE)
#define _php3_hash_next_index_insert(ht,pData,nDataSize,pDest) \
***************
*** 95,101 ****
extern PHPAPI int _php3_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void
*pData);
! extern PHPAPI int _php3_hash_pointer_index_update_or_next_insert(HashTable *ht, uint h, void
*pData, int flag);
#define _php3_hash_pointer_index_update(ht,h,pData) \
_php3_hash_pointer_index_update_or_next_insert(ht,h,pData,HASH_UPDATE)
#define _php3_hash_next_index_pointer_insert(ht,pData) \
--- 95,101 ----
extern PHPAPI int _php3_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void
*pData);
! extern PHPAPI int _php3_hash_pointer_index_update_or_next_insert(HashTable *ht, ulong h, void
*pData, int flag);
#define _php3_hash_pointer_index_update(ht,h,pData) \
_php3_hash_pointer_index_update_or_next_insert(ht,h,pData,HASH_UPDATE)
#define _php3_hash_next_index_pointer_insert(ht,pData) \
***************
*** 106,112 ****
/* Deletes */
! extern PHPAPI int _php3_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, uint h,
int flag);
#define _php3_hash_del(ht,arKey,nKeyLength) \
_php3_hash_del_key_or_index(ht,arKey,nKeyLength,0,HASH_DEL_KEY)
#define _php3_hash_index_del(ht,h) \
--- 106,112 ----
/* Deletes */
! extern PHPAPI int _php3_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong
h, int flag);
#define _php3_hash_del(ht,arKey,nKeyLength) \
_php3_hash_del_key_or_index(ht,arKey,nKeyLength,0,HASH_DEL_KEY)
#define _php3_hash_index_del(ht,h) \
***************
*** 114,127 ****
/* Data retreival */
extern PHPAPI int _php3_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
! extern PHPAPI int _php3_hash_index_find(HashTable *ht, uint h, void **pData);
/* Misc */
extern PHPAPI int _php3_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
! extern PHPAPI int _php3_hash_index_exists(HashTable *ht, uint h);
extern PHPAPI int _php3_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength);
! extern PHPAPI int _php3_hash_index_is_pointer(HashTable *ht, uint h);
! extern PHPAPI uint _php3_hash_next_free_element(HashTable *ht);
/* traversing */
extern PHPAPI void _php3_hash_move_forward(HashTable *ht);
--- 114,127 ----
/* Data retreival */
extern PHPAPI int _php3_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData);
! extern PHPAPI int _php3_hash_index_find(HashTable *ht, ulong h, void **pData);
/* Misc */
extern PHPAPI int _php3_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
! extern PHPAPI int _php3_hash_index_exists(HashTable *ht, ulong h);
extern PHPAPI int _php3_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength);
! extern PHPAPI int _php3_hash_index_is_pointer(HashTable *ht, ulong h);
! extern PHPAPI ulong _php3_hash_next_free_element(HashTable *ht);
/* traversing */
extern PHPAPI void _php3_hash_move_forward(HashTable *ht);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net