At 14:36 19/07/2001, Marc Boeren wrote:
> > When you build the result hash, use the same zval * in both
> > places (don't forget the right refcount), it should work.
>
> >Yes, just use the same zval *, increase refcount accordingly, and set the
> > is_ref bit. It'd be much faster (and also more correct) than using the
> > assign_to_variable_reference() function...
>
>OK, could you help me out here?
>
>Can I just do this:
>
>zend_hash_index_find((*row_ptr)->value.ht, col_index, (void **)
>&actual_ptr);
>(*actual_ptr)->refcount++;
>(*actual_ptr)->is_ref =1;
>zend_hash_update((*row_ptr)->value.ht, (*columnname_ptr)->value.str.val,
>(*columnname_ptr)->value.str.len + 1, actual_ptr, sizeof(zval *), NULL);
>
>This seems to work. However, I tried it without the refcount and is_ref
>statements, and it still seems to work... (this is in the 4.0.6 version,
>btw)
>There is no memory loss for both versions...
(a) You only have to set is_ref once.
(b) If you don't increase the refcount, the behavior is undefined, and is
likely to end up crashing PHP. Not increasing refcount may actually give
you the same behavior as setting is_ref to 1, but it would crash, sooner or
later.
Zeev
--
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]