According to all documentation I've found, a zend_function_entry[] array
should be ended with { NULL, NULL, NULL
}, but I've noticed that
_zend_function_entry now has five parts; differences:
-unsigned char *func_arg_types;
+struct _zend_arg_info *arg_info;
+zend_uint num_args;
+zend_uint flags;
Technically, it would make sense to end the array with five NULLs instead
of three, but that doesn't seem to be reflected by
'ext/skeleton/skeleton.c', so I don't know if it's a necessary change or
not. If it should be changed, I'd also recommend making a macro for the
ending so that this sort of problem won't pop up again in the future, and
it would also make more sense than just having seemingly random NULLs
which could be better described with a macro.
According to all documentation I've found, a
zend_function_entry[] array should be ended
with { NULL, NULL,NULL
}, but I've noticed
that _zend_function_entry now has five parts;
Your analysis is correct, however(functionally speaking) the only attribute
that NEEDs to be explicitly set NULL
is fname. The rest can be garbage and
everything will still function fine. The second and third elements are set
NULL
becasue they can be safely without losing version agnosticism.
We could extend the skeleton with a couple of zeros in those elements, but
it'd need a note on the indavisability of doing that if you need BC with 4
(the compiler would spit error about excess elements in initializer).
I'm all for a macro, maybe even a full start/end set like the
global/ini/arg_info declarations have. Again, there's version BC to be
considered, but that can be solved with some #ifndefs in the skeleton...
PHP_BEGIN_FUNCTION_LIST(extname)
PHP_FE(...)
PHP_FE(...)
PHP_FE(...)
PHP_END_FUNCTION_LIST(extname)
Same for the module entry....
These are all just window dressing though so unless someone else sees this
as a worthwhile thing...shrug
-Sara
At least the C++ standard guarantees that all remaining members of the
struct are initialized with their respective default value (which
would is be 0/NULL). So technically speaking, simply using {NULL} is
absolutely fine.
From a cursory glance it appears to me that it is the same with C, but
feel free to check the standard on your own ;)
Regards,
Michael
According to all documentation I've found, a
zend_function_entry[] array should be ended
with { NULL, NULL,NULL
}, but I've noticed
that _zend_function_entry now has five parts;Your analysis is correct, however(functionally speaking) the only attribute
that NEEDs to be explicitly setNULL
is fname. The rest can be garbage and
everything will still function fine. The second and third elements are set
NULL
becasue they can be safely without losing version agnosticism.We could extend the skeleton with a couple of zeros in those elements, but
it'd need a note on the indavisability of doing that if you need BC with 4
(the compiler would spit error about excess elements in initializer).I'm all for a macro, maybe even a full start/end set like the
global/ini/arg_info declarations have. Again, there's version BC to be
considered, but that can be solved with some #ifndefs in the skeleton...PHP_BEGIN_FUNCTION_LIST(extname)
PHP_FE(...)
PHP_FE(...)
PHP_FE(...)
PHP_END_FUNCTION_LIST(extname)Same for the module entry....
These are all just window dressing though so unless someone else sees this
as a worthwhile thing...shrug-Sara