Hi Tiziano,
thanks a lot for your patches. I pushed them already. Just one more thing: By libvirt-php prefix I didn't mean to start subject with libvirt-php directly but to format patches using `git format-patch -X --subject-prefix="libvirt-php PATCH"` or you can set it directly in the .git/config file in your cloned repository. You can use git send-email since your version of git should support it however the resulting subject will be:

[libvirt] [libvirt-php PATCH] something

and now it's still:

[libvirt] [PATCH] something

So if you don't put "libvirt-php" in the beginning of your commit line I could get confused whether it's for libvirt-php or libvirt itself. You can set it in your config also using the following command in the libvirt-php cloned repository:

git config --local format.subjectprefix "libvirt-php PATCH" (or just "libvirt-php" is OK too).

This is mentioned on the contributions page of libvirt-php available at [1].

Thanks,
Michal

[1] http://libvirt.org/php/contributions.html

On 03/08/2011 11:00 AM, Tiziano Mueller wrote:
This is a revised patch to also fix the call to libvirt_version without
arguments and without Xen.

Currently libvirt_connect fails if libvirt has no Xen support.
This is because virGetVersion checks for Xen if typeVer!=NULL.
The same applies for libvirt_version if called without arguments
and no Xen available.

---
  src/libvirt.c |   24 +++++++++++++++---------
  1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index ce39a28..9636166 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -173,13 +173,12 @@ PHP_RSHUTDOWN_FUNCTION(libvirt)
  PHP_MINFO_FUNCTION(libvirt)
  {
        unsigned long libVer;
-       unsigned long typeVer;
        char *version;
        php_info_print_table_start();
        php_info_print_table_row(2, "Libvirt support", "enabled");
        php_info_print_table_row(2, "Extension version", 
PHP_LIBVIRT_WORLD_VERSION);

-       if (virGetVersion(&libVer,NULL,&typeVer)== 0)
+       if (virGetVersion(&libVer,NULL,NULL)== 0)
        {
                version=emalloc(100);
                snprintf(version, 100, "%i.%i.%i", (long)((libVer/1000000) % 
1000),(long)((libVer/1000) % 1000),(long)(libVer % 1000));
@@ -590,13 +589,12 @@ PHP_FUNCTION(libvirt_connect)
        unsigned long index;

        unsigned long libVer;
-       unsigned long typeVer;

        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
"|sba",&url,&url_len,&readonly,&zcreds) == FAILURE) {
                RETURN_FALSE;
        }

-       if (virGetVersion(&libVer,NULL,&typeVer)!= 0)
+       if (virGetVersion(&libVer,NULL,NULL)!= 0)
                RETURN_FALSE;

        if (libVer<6002)
@@ -3358,8 +3356,13 @@ PHP_FUNCTION(libvirt_version)
                RETURN_FALSE;
        }

-       if (virGetVersion(&libVer,type,&typeVer) != 0)
-               RETURN_FALSE;
+       if (ZEND_NUM_ARGS() == 0) {
+               if (virGetVersion(&libVer,NULL,NULL) != 0)
+                       RETURN_FALSE;
+    } else {
+               if (virGetVersion(&libVer,type,&typeVer) != 0)
+                       RETURN_FALSE;
+       }

        /* The version is returned as: major * 1,000,000 + minor * 1,000 + 
release. */
        array_init(return_value);
@@ -3372,9 +3375,12 @@ PHP_FUNCTION(libvirt_version)
        add_assoc_long(return_value, "connector.major", VERSION_MAJOR);
        add_assoc_long(return_value, "connector.minor", VERSION_MINOR);
        add_assoc_long(return_value, "connector.release", VERSION_MICRO);
-       add_assoc_long(return_value, "type.release",(long)(typeVer %1000));
-       add_assoc_long(return_value, "type.minor",(long)((typeVer/1000) % 
1000));
-       add_assoc_long(return_value, "type.major",(long)((typeVer/1000000) % 
1000));
+
+    if (ZEND_NUM_ARGS()>  0) {
+               add_assoc_long(return_value, "type.release",(long)(typeVer 
%1000));
+               add_assoc_long(return_value, "type.minor",(long)((typeVer/1000) 
% 1000));
+               add_assoc_long(return_value, 
"type.major",(long)((typeVer/1000000) % 1000));
+    }
  }

  /*


--
Michal Novotny<minov...@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to