Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81758 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12003 invoked from network); 4 Feb 2015 04:05:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2015 04:05:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:32808] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/51-20608-79A91D45 for ; Tue, 03 Feb 2015 23:05:43 -0500 Received: by mail-la0-f48.google.com with SMTP id pv20so55837673lab.7 for ; Tue, 03 Feb 2015 20:05:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=vbud3z4pkh5RYRMP9krwRjQrfM7C3IhIvlBkxnl5vfY=; b=WePsQczd3Ek5fHC6GGyungQNb8kbRD+pIeZiSVsgddy1eMW/ItG+ctWTHLOSX9xxaB napQkhKZpX89hiyAkN9E7KMFyLbQWCyVlNYCmlm8f0mlJrlmMCsY3B952d681ryE6gDs TGYhdfehI3Swm9UFuneSzhkM7g+zTNIOK/dTAOnzVyi4jygK0Y0QfhF4LKtd/OPh7bgi xdXcr8a84gmr9eM0Boz3WkaS12WFOGbFzb8lsifFpfIHDA4F1wOmiukGDv0brNNfNPAb g2PggDocC11KtGxvCYyknuFa24WYVRrsBAQLSAFYayqg72k4R6MyP+JVja/+9HPdV9F8 /5aw== X-Gm-Message-State: ALoCoQn79GJ4OS3JazbNyLVQlpYz5D+dwKd5+TpZUVkCs17X36ankP37Hp/h59N0VH/HQb/uM9kzGgd/9YZbcTp3Wen9kyoc3cMk5TxCw5m7hQD+kIAxrGNQPB8K9XbN3wxSTlOmXXPX93DjcQnHYQsxC27lz/bT9Q== X-Received: by 10.152.5.226 with SMTP id v2mr6436971lav.34.1423022740435; Tue, 03 Feb 2015 20:05:40 -0800 (PST) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPSA id s7sm97230las.17.2015.02.03.20.05.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 20:05:39 -0800 (PST) Received: by mail-la0-f41.google.com with SMTP id gm9so56091583lab.0 for ; Tue, 03 Feb 2015 20:05:38 -0800 (PST) X-Received: by 10.112.198.233 with SMTP id jf9mr28868874lbc.9.1423022738637; Tue, 03 Feb 2015 20:05:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.28.193 with HTTP; Tue, 3 Feb 2015 20:05:18 -0800 (PST) In-Reply-To: <008a01d03f06$8cae6f20$a60b4d60$@tekwire.net> References: <008a01d03f06$8cae6f20$a60b4d60$@tekwire.net> Date: Wed, 4 Feb 2015 12:05:18 +0800 Message-ID: To: francois Cc: PHP Internals , Dmitry Stogov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: [DICUSS]Cleanup resource handling APIs From: laruence@php.net (Xinchen Hui) Hey: On Tue, Feb 3, 2015 at 12:37 AM, Fran=C3=A7ois Laupretre wrote: >> De : Xinchen Hui [mailto:laruence@php.net] >> furthermore, I'd like to discuss remove the handle in zend_resource stru= ct.. >> >> it may breaks some usage (use resource as long/double/string) >> >> case IS_RESOURCE: { >> char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG]; >> int len; >> >> len =3D snprintf(buf, sizeof(buf), "Resource id #" >> ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op)); >> return zend_string_init(buf, len, 0); >> } > > I don't understand how you can delete the resource if you remove the hand= le from the zend_resource struct. Or would you store the index elsewhere ? if you use HashTable , yes, it's hard to get rid of it, but we can hidden it from user land.. and actually, we only use integer index of regular_list for zend_resource.= . if we decide to remove handle, then it maybe easy to re-implement it as a plain c array like zend_resource[]; and when doing realloce, we allocate new segment, and link them togther. et= c thanks > > Regards > > Fran=C3=A7ois > --=20 Xinchen Hui @Laruence http://www.laruence.com/