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 ask
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
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php