At 11:28 AM 5/12/2001 +0100, Wez Furlong wrote:
>On 2001-05-12 10:12:14, "Andi Gutmans" <[EMAIL PROTECTED]> wrote:
> > The code is almost OK. The only problem is that the reference count and
>
> > is_ref from rfcbuf->headers are also copied to *headers. So what you
>should
> > be doing (if you only add it once to the return_value) is to do
> > INIT_PZVAL(headers) before the hash_update so that they are reset to
> > refcount=1 is_ref=0.
>
>Like this?
>
>zval * headers;
>
>MAKE_STD_ZVAL(headers);
>*headers = *rfcbuf->headers;
>INIT_PZVAL(headers);
>if (zval_copy_ctor(headers) == SUCCESS)  {
>     zend_hash_update(HASH_OF(return_value), "headers",
>         sizeof("headers"), &headers, sizeof(headers)
>         NULL);
>}

Yep that's good.
By the way, another thing. You don't have to do the zval_copy_ctor() == 
SUCCESS either. I guess it is more correct but we don't do it anywhere in 
our code and if it ever happens we're screwed anyway. It could probably 
return void but I'd have to go back in time and think why it was done the 
way it was :)

Andi


> > And by the way, zval_copy_ctor does recursive copy constructing so your
>
> > code is OK.
>
>Great; that's a relief :-)
>
>Thanks!
>
>--Wez.


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to