Johannes, all,
Best, of course, would be to show code.
(Mind: It is legal to have an open source extension on top a closed
library if you don't want to share some library ... benefit then is that
it might be put in PECL, eventually you get windows builds and bugfixes
from PHP maintainers aside from improved visibility to potential
users ...)
I have no reservations over showing my code. I just find it hard to expect
from anybody that they would actually go through it instead of me. And, after
all, code reduction is a fair approach.
However, it may be that I have problems already within my PHP extension file
with declaring or assigning PHP classes and the like. When I get to my machine
I will gladly disclose that file as well as the PHP version ...
The typical pattern we use is either to add a flag to the structure,
something like
struct record {
int id;
zend_bool need_free; /* zend_bool is a uint */
char * name;
. . .
};
So there is no chance that something like
if (may_be_efreed(address)) efree(address);
would fit within Zend?
Kajetan