Re: persistent memory management
| From: | Antony Dovgal | Date: | Sun, 03 Dec 2006 10:55:30 +0000 |
| Subject: | Re: persistent memory management | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-26771@lists.php.net to get a copy of this message | ||
On 12/02/2006 11:07 PM, Alexey Zakhlestin wrote:
Hi. I am trying to make my first php extension :) I am sorry, if the question would be too newbiesh, but I just couldn't find a more correct place to askNo 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