Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86776 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73434 invoked from network); 22 Jun 2015 01:50:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jun 2015 01:50:35 -0000 Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:18100] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/30-04959-6E967855 for ; Sun, 21 Jun 2015 21:50:32 -0400 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 82EB34B0175 for ; Mon, 22 Jun 2015 03:50:25 +0200 (CEST) Reply-To: To: Date: Mon, 22 Jun 2015 03:50:23 +0200 Message-ID: <001a01d0ac8d$cdeecd50$69cc67f0$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AdCsfqoIxDyr4s0mQSiFLvswmheM2w== Content-Language: fr X-Antivirus: avast! (VPS 150621-1, 21/06/2015), Outbound message X-Antivirus-Status: Clean Subject: [PROPOSAL] zend_string API changes and additions From: francois@php.net (=?iso-8859-1?Q?Fran=E7ois_Laupretre?=) Hi, I'd like your comments on a PR = (https://github.com/php/php-src/pull/1353) I just wrote to propose two changes to the zend_string API. Both are = different but, as they apply to the same file, it was easier to merge them the = same PR : 1. Suppress the 'persistent' arg from zend_string = realloc/extend/truncate functions This argument is useless because : - perealloc() cannot re-allocate from non-persistent memory to persistent or from persistent to non-persistent. So, the 'persistent' argument value we give to the zend_string_realloc() function is totally constrained : it *must* be the same as the value provided when the zend_string was created. - This information is present in the zend_string structure as (GC_FLAGS(s) & IS_STR_PERSISTENT). So, the 'persistent' argument is useless and can only lead to failures. That's why I propose we remove it from the API as soon as possible = (7.0.0 alpha2 ?). It creates a small BC break for extension maintainers, but I think it's still better than pulling this behind us during years. As an indication of the BC break for extension maintainers, the whole core distribution contains about 50 calls to one of these functions (PR = includes fixes). 2. Add a set of zend_string_append() functions Added functions to append to a zend_string from : - another zend_string, - a pair (char *, len), - a literal string, - or a null-terminated string (using strlen()). IMHO, these features are common enough to be part of the API. Regards Fran=E7ois