Re: [PHP4BETA] can zend_hash_add used with local variables?

[email protected] (Andrei Zmievski)
Newsgroups php.version4
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.