Date: 10/23/00
- Next message: amihai <email protected>: "[PHP-DEV] PHP 4.0 Bug #7411 Updated: Fail to compile"
- Previous message: amihai <email protected>: "[PHP-DEV] PHP 4.0 Bug #7411: Fail to compile"
- In reply to: Stanislav Malyshev: "[PHP-DEV] Serializing references - part I"
- Next in thread: Stanislav Malyshev: "Re: [PHP-DEV] Serializing references - part I"
- Reply: Stanislav Malyshev: "Re: [PHP-DEV] Serializing references - part I"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 22 Oct 2000, Stanislav Malyshev wrote:
> +inline int php_add_var_hash(HashTable *var_hash, zval *var, void *var_old) {
> + ulong var_no;
> + char id[sizeof(void *)*2+3];
> +
> + snprintf(id,sizeof(id)-1,"%p",var);
> + id[sizeof(id)-1]='\0';
> + if(var_old && zend_hash_find(var_hash,id,sizeof(void *)*2,var_old) == SUCCESS) {
> + return FAILURE;
> + }
> +
> + var_no = zend_hash_num_elements(var_hash)+1; /* +1 because otherwise hash will think we are trying to store NULL pointer */
> + zend_hash_add(var_hash,id,sizeof(void *)*2,&var_no,sizeof(var_no),NULL);
> + return SUCCESS;
> +}
Why not simply cast pointer to integer and use it as the key?
-Andrei
* Non-volatile, random-access, analog memory store... a book. *
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: amihai <email protected>: "[PHP-DEV] PHP 4.0 Bug #7411 Updated: Fail to compile"
- Previous message: amihai <email protected>: "[PHP-DEV] PHP 4.0 Bug #7411: Fail to compile"
- In reply to: Stanislav Malyshev: "[PHP-DEV] Serializing references - part I"
- Next in thread: Stanislav Malyshev: "Re: [PHP-DEV] Serializing references - part I"
- Reply: Stanislav Malyshev: "Re: [PHP-DEV] Serializing references - part I"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

