Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80099 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84460 invoked from network); 2 Jan 2015 16:03:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2015 16:03:12 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:56917] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/04-61219-A31C6A45 for ; Fri, 02 Jan 2015 11:03:07 -0500 Received: by h1123647.serverkompetenz.net (Postfix, from userid 33) id 8A9D123D6002; Fri, 2 Jan 2015 17:03:03 +0100 (CET) Received: from 87.159.54.177 (SquirrelMail authenticated user anatol@belski.net) by webmail.klapt.com with HTTP; Fri, 2 Jan 2015 17:03:03 +0100 Message-ID: Date: Fri, 2 Jan 2015 17:03:03 +0100 To: "Anatol Belski" Cc: "Dmitry Stogov" , "Xinchen Hui" , "Nikita Popov" , internals@lists.php.net, "Pierre Joye" User-Agent: SquirrelMail/1.5.2 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] resource consistency From: anatol.php@belski.net ("Anatol Belski") Hi, On Wed, December 31, 2014 23:21, Anatol Belski wrote: > Hi, > > > related to bug #43525, I see that zend_fetch_resource() still expects a > default id as int as parameter. After some investigation i think that the > "int default_id" argument can be surely dropped from the signature. The > only extension in the core passing it is ext/interbase, all the others pass > -1. Any other zend_list_* signature expects no integer but a > zend_resource*. > > What I would do instead - transfer the control over the defauld_id to the > corresponding extension. Maybe also making a helper function in > zend_list.c, if it proves itself as needed. But in any case, to be > consistent, the consistency should be that the api only works with > zend_resource *. > Here's a small patch i've invented to illustrate the idea https://gist.github.com/weltling/9367db5e242ef7e60042 . The most relevant change is in zend_list.[h|c]. I've also exemplarly ported ext/mysql and ext/pgsql. The macros ZEND_FETCH_RESOURCE*() would not change the meaning, but new macros ZEND_FETCH_RESOURCE_FROM_*() are introduced. Also the zend_fetch_resource() function is removed. From the code base, the new function zend_fetch_resource_from_zval() were suitable, which would spare several branchings. Thanks Anatol