Re: Proposal: Introduce a new macro:php_error_docref_ex()
| From: | reeze | Date: | Wed, 11 Feb 2015 08:21:54 +0000 |
| Subject: | Re: Proposal: Introduce a new macro:php_error_docref_ex() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82456@lists.php.net to get a copy of this message | ||
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 <laruence@php.net> wrote:
> On Wed, Feb 11, 2015 at 4:07 PM, reeze <reeze@php.net> 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