Re: [PHP4BETA] can zend_hash_add used with local variables?
| From: | Andrei Zmievski | Date: | Fri, 26 May 2000 14:39:02 +0000 |
| Subject: | Re: [PHP4BETA] can zend_hash_add used with local variables? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-15794@lists.php.net to get a copy of this message | ||
On Fri, 26 May 2000, Thies C . Arntzen wrote:
>
> not too sure - is:
>
> {
> putenv_entry pe;
> ....
> zend_hash_add(&BG(putenv_ht),pe.key,pe.key_len+1,(void **)
> &pe,sizeof(putenv_entry),NULL);
>
> ...
>
> valid?
>
> usually one would alloc a putenv_entry * and pass that to
> hash_add, right?
It depends. If you are storing a pointer to data, then you need to
allocate dynamically. If you are storing the data itself, then it'll be
copied by zend_hash_*() functions.
-Andrei
"When I get a little money, I buy books;
and if any is left I buy food and clothes." -- Erasmus