Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82456 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79161 invoked from network); 11 Feb 2015 08:22:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2015 08:22:27 -0000 Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wg0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:65103] helo=mail-wg0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/80-33902-D311BD45 for ; Wed, 11 Feb 2015 03:22:24 -0500 Received: by mail-wg0-f42.google.com with SMTP id x13so1842615wgg.1 for ; Wed, 11 Feb 2015 00:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=UfSiUUZM0uc8EZLHwzP4jbyGKrw4655/OxBcZVwSCvI=; b=WZfniiHuQpdGElKwTTboU7bvMcLyAUnugoSPOEGb2JejsFw0fyktF7a7lUI2IDr4bC +ghy4Rz+0vZX/iBKY4/0XQRT6Gwa2t/vCCYBcGTYbkLyZ78sLbd+R0OnjmMxYPodlQp/ cdlZK2qxyLMzK0jUd7KLPNOlc+rRdUzjAHAo7BJSUPgH2DTVDCkV8QltCc302+E2aV1b XUBGPRECdvaOIoFgSMi4Gol2PynobTqAlg9znnkAqGbuCG87U25POMVkqer8oDBwGJJz cXcibx47A8uA9bY0AOFgQDO3EcGa7GTbskqNFMGFxmje1thhlFLKftdUblNCWQ3gh0TU 8fvw== X-Received: by 10.194.158.234 with SMTP id wx10mr61479258wjb.23.1423642934216; Wed, 11 Feb 2015 00:22:14 -0800 (PST) MIME-Version: 1.0 Sender: reeze.xia@gmail.com Received: by 10.194.193.5 with HTTP; Wed, 11 Feb 2015 00:21:54 -0800 (PST) In-Reply-To: References: Date: Wed, 11 Feb 2015 16:21:54 +0800 X-Google-Sender-Auth: w7-O9I0OF_4iShZ8-sDPr9jyhZU Message-ID: To: Xinchen Hui Cc: "internals@lists.php.net" , Dmitry Stogov , Yasuo Ohgaki Content-Type: multipart/alternative; boundary=089e013c625c619072050ecbb361 Subject: Re: Proposal: Introduce a new macro:php_error_docref_ex() From: reeze@php.net (reeze) --089e013c625c619072050ecbb361 Content-Type: text/plain; charset=ISO-8859-1 I think it is a cleanup, it works but there are too many duplication. it is the time to make the code clean and easier to understand. I myself don't know why should I need the first NULL when I am a newcomer of writing extensions, it just seems everyone do that, before PHP7 there is a strange TSRML_CC macro, it is hard to maintain. On 11 February 2015 at 16:16, Xinchen Hui wrote: > On Wed, Feb 11, 2015 at 4:07 PM, reeze wrote: > > Hi all, > > There are a lot of code use php_error_docref() macro, the first > > parameter > > mostly is NULL, before PHP7, it looks like: > > > > php_error_docref(NULL TSRML, E_WARNING, "recursion detected"); > > in PHP7 > > php_error_docref(NULL, E_WARNING, "recursion detected"); > > looks better, but the first parameter look dumb. > > > > I did a simple statics, there are: > > > > Null docref: 2530 > > Not Null docref: 51 > > > > I searched on Github, it seems that almost all of the extension use NULL > > docref. > > > > So I propose add a new macro, like: php_error_error_docref_ex(E_WARNING, > > "xxx"). > > this could make code looks better and the extension maintainer's easier. > > > > Another option would be just update the php_error_docref() macro to > remove > > the docref parameter, default to NULL but not add a new macro. > > > > > > What do you think about it? > No. > > I can't see any benefit from it, but lots of changes. > > everything works well now. > > thanks > > > > [1] https://github.com/php/php-src/pull/1075 > > > > -- > > Reeze Xia > > http://reeze.cn > > > > -- > Xinchen Hui > @Laruence > http://www.laruence.com/ > -- Reeze Xia http://reeze.cn --089e013c625c619072050ecbb361--