On 06/23/2017 10:58 AM, Michal Privoznik wrote:
<snip/>
But this got me thinking, should we follow libvirt's example and finally
split src/libvirt-php.c into smaller files that would handle just one
object? For example:
libvirt-domain.c
libvirt-nwfilter.c
libvirt-storage.c
libvirt-network.c
and so on.
Just a clarification on this: I think libvirt-php.c should contain just
the necessary glue/register functions for PHP objects and include
libvirt-domain.h, libvirt-nwfilter.h, libvirt-storage.h, etc.
The macros we have for dealing with different version of PHP (e.g.
VIRT_RETURN_RESOURE or VIRT_RETVAL_STRING and friends) can then go to
util.h (which can be included from all the new *.c files).
libvirt-domain.h could then have all those
PHP_FUNCTION(libvirt_domain_*) declarations from libvirt-php.h;
libvirt-nwfilter.h could have all those PHP_FUNCTION(libvirt_nwfilter_*)
declarations, and so on.
The reasoning for this is to have clear dependencies between source
files. This basically mimics what we have in libvirt too.
Unfortunately, I'm leaving the office for some time now so I will not
have time to write this myself. So if you guys want to propose the
patches, please be my guest. Otherwise I'll look into it once I'm back.
Michal