Re: persistent memory management

From: Date: Sun, 03 Dec 2006 11:53:19 +0000
Subject: Re: persistent memory management
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-26773@lists.php.net to get a copy of this message
thanks. fixed it in subversion On 12/3/06, Antony Dovgal <antony@zend.com> wrote:
No need to use _exists here, zend_hash_find() returns FAILURE if it's failed to find the value. You're doing the hash lookup twice here:
        if (!zend_hash_exists(ht, ns_name, ns_len + 1)) {
                return NULL;
        }
        zend_hash_find(ht, ns_name, ns_len + 1, (void**)&res);
Just this is enough: if (zend_hash_find() == SUCCESS) { return res; } return NULL; And Andrey is right, valgrind is priceless when it comes to debugging memory errors. -- Wbr, Antony Dovgal
-- Alexey Zakhlestin http://blog.milkfarmsoft.com/

« previous php.internals (#26773) next »