Re: Publishing my PHP extension to PECL
| From: | Johannes Schlüter | Date: | Mon, 08 Sep 2014 22:40:03 +0000 |
| Subject: | Re: Publishing my PHP extension to PECL | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-12258@lists.php.net to get a copy of this message | ||
Hi,
On Fri, 2014-09-05 at 05:05 -0700, Boro Sitnikovski wrote:
> Hi Johannes,
>
> Thanks for the remarks. I've pushed a new commit that fixes them.
PHP_FUNCTION(xmp_create_context)
{
/* ... */
xmp = xmp_create_context();
memcpy(xmp_ptr, &xmp, sizeof(xmp_context));
if (xmp) {
ZEND_REGISTER_RESOURCE(return_value, xmp_ptr, le_xmp);
} else {
RETURN_FALSE;
}
}
this still looks suspicious to me. You always copy contents of xmp to
xmp_ptr and only later check value of xmp. Quick look at docs tells me
that xmp_create_context() apparently can't report an error and something
like this might be enough:
PHP_FUNCTION(xmp_create_context)
{
xmp_context *xmp;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
xmp = emalloc(sizeof(xmp_context));
*xmp = xmp_create_context();
ZEND_REGISTER_RESOURCE(return_value, xmp, le_xmp);
}
> I requested a PECL account using that form.
Creating the repo is in the works.
johannes