Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76690 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63719 invoked from network); 19 Aug 2014 09:21:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2014 09:21:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.43 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.43 mail-qa0-f43.google.com Received: from [209.85.216.43] ([209.85.216.43:47747] helo=mail-qa0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/B1-55441-50713F35 for ; Tue, 19 Aug 2014 05:21:09 -0400 Received: by mail-qa0-f43.google.com with SMTP id w8so5427896qac.16 for ; Tue, 19 Aug 2014 02:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=in+DtPxzhfRsteyrhiVd96sguwODG9JefMLTJX4jDfg=; b=VWL2ujc2T59zJqLHI0dNude78IXu65EZLRGnJNT/eHcITYDiDQD9iaWeQGT5m8ebqn 9x1d9Cmizey1u9TwvTdSkZBt1suVMH7g8GsVh0X2xtAlZdShmuag1silGZeSBzDIKzjU FXP3L7TWbXP+bpnz0z2MfcX/MT0IThffc9ExUH8U+v/5qhrBEoGoactQCJv/LKNxVeTr BIbRDy/Sa6BU37VsGJG7H2as6BiC5LyY8wXKq+Db1wHnuMIvKLfR4D+qo8T7SwsnZmCF pDL6zwooBh331PSV0jCcm8LV+C2wxY5nZrhhiC4SLAQxKG+fBOiBr40zyroLUY6Vtho1 drXA== MIME-Version: 1.0 X-Received: by 10.140.106.225 with SMTP id e88mr61309436qgf.20.1408440066882; Tue, 19 Aug 2014 02:21:06 -0700 (PDT) Received: by 10.140.95.146 with HTTP; Tue, 19 Aug 2014 02:21:06 -0700 (PDT) In-Reply-To: <96C1DD0341854844A3A3E43FA3608A2F@gmail.com> References: <86EEE03317124B84B62883DBE41C4ADD@gmail.com> <35D406B0A53A43FEAF472D9FC8371187@gmail.com> <96C1DD0341854844A3A3E43FA3608A2F@gmail.com> Date: Tue, 19 Aug 2014 11:21:06 +0200 Message-ID: To: Wei Dai Cc: Derick Rethans , Aaron Lewis , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: =?UTF-8?B?UmU6IFtQSFAtREVWXSBSZTog5Zue5aSN77yaIFtQSFAtREVWXSDlm57lpI3vvJogW1BIUA==?= =?UTF-8?B?LURFVl0gSG93IHNob3VsZCBJIGNhbGwgYSBQSFAgZnVuY3Rpb24=?= From: pierre.php@gmail.com (Pierre Joye) On Tue, Aug 19, 2014 at 11:11 AM, Wei Dai wrote: > > On Tue, Aug 19, 2014 at 10:55 AM, Derick Rethans wrote: > > On Tue, 19 Aug 2014, Wei Dai wrote: > > On Mon, 18 Aug 2014, Wei Dai wrote: > > > so, i have two options: > > 1. copy the duplicate code into my extension, It can be fast in this > way, but the code is not beautiful. > > 2. call call_user_function(_ex) , it=E2=80=99s slower than the first opti= on, > but the code is more simple and beautiful than the first option. > > > or: > > 3. refactor the functionality in PHP so that trim or others *can* be > used in extensions. > > > Best option, while not possible for existing releases, a good example > (trim): > > http://lxr.php.net/xref/phpng/ext/standard/string.c#784 > > trim is just an example, we can call it 'x'. > x is a php function and it doesn't have a common C api. Yes, just pointing you at how it could be done, for functions not exposed as a C API. --=20 Pierre @pierrejoye | http://www.libgd.org