Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26773 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2928 invoked by uid 1010); 3 Dec 2006 11:53:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 2913 invoked from network); 3 Dec 2006 11:53:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Dec 2006 11:53:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=good Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.184 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 64.233.182.184 nf-out-0910.google.com Linux 2.4/2.6 Received: from [64.233.182.184] ([64.233.182.184:20037] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/44-04825-2BAB2754 for ; Sun, 03 Dec 2006 06:53:57 -0500 Received: by nf-out-0910.google.com with SMTP id l35so4417119nfa for ; Sun, 03 Dec 2006 03:53:20 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UxuxG4dwt5xtoy43a/jX80o71ZOesEpA7UvIGRjBpgzRKyAqF9UZYIokNXgD1+XRPaMTFfY/403WbzkGxVss+0q9ZsWhu6JeOlj2uhVCMcijrZB16VQeM+/ZLOLatvabCrRQzORBAERY1REIn/ipgtO0hLBh1x9nGupPqBOjIwE= Received: by 10.78.97.7 with SMTP id u7mr6647657hub.1165146800014; Sun, 03 Dec 2006 03:53:20 -0800 (PST) Received: by 10.78.162.2 with HTTP; Sun, 3 Dec 2006 03:53:19 -0800 (PST) Message-ID: Date: Sun, 3 Dec 2006 14:53:19 +0300 To: internals@lists.php.net In-Reply-To: <4572AD22.7070005@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4572AD22.7070005@zend.com> Subject: Re: [PHP-DEV] persistent memory management From: indeyets@gmail.com ("Alexey Zakhlestin") thanks. fixed it in subversion On 12/3/06, Antony Dovgal 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/