From nobody Mon Feb 9 21:22:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498158935780428.973919263967; Thu, 22 Jun 2017 12:15:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 209977C82E; Thu, 22 Jun 2017 19:15:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0C1D17103; Thu, 22 Jun 2017 19:15:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A665F184383E; Thu, 22 Jun 2017 19:15:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5MJEFaG013759 for ; Thu, 22 Jun 2017 15:14:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 784E65C7A7; Thu, 22 Jun 2017 19:14:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 725915C7A5 for ; Thu, 22 Jun 2017 19:14:13 +0000 (UTC) Received: from mail-qk0-f176.google.com (mail-qk0-f176.google.com [209.85.220.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E4937D4E0 for ; Thu, 22 Jun 2017 19:14:11 +0000 (UTC) Received: by mail-qk0-f176.google.com with SMTP id r62so20074397qkf.0 for ; Thu, 22 Jun 2017 12:14:11 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id g39sm1837145qtc.12.2017.06.22.12.14.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Jun 2017 12:14:10 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 209977C82E Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 209977C82E Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=datto-com.20150623.gappssmtp.com header.i=@datto-com.20150623.gappssmtp.com header.b="oJD/4N9d" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8E4937D4E0 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8E4937D4E0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datto-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=q7U9u18goEWYiov0uqwuJfW67Bkd4aDTwBPP92Ly2S4=; b=oJD/4N9d7VS+nXd9GmonAcFwrgz2cL8vzpSiCXdcu5vVUQ8j/mrrma3+DyMKG3fhvo 0fVKx4jtb5aQ0F/MRJR7mRVo4eE0Rsay0covkg+RA0ApWiMYpwbmoN6StskoghM8KgLR uipFxTEClZTXbu0Ctw4REWXYq4p8I9affBPTeAmgucoF0gZxw3znag1Bd49zOUZ/nrq1 TEoG6IdYBr1kOQgbrPk95IVjZzcg2UrHMKwaLXkN7Fy6xdApVF79Qjimydeo+mztWKEH 2m+tu2p6oJrypPBgPRwej3b+iRywBTzYm+kXrBlp4GekPG1z62C6E50Gd0AOmNIBI3ci IJUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=q7U9u18goEWYiov0uqwuJfW67Bkd4aDTwBPP92Ly2S4=; b=eweE5DBKZUJpGVL14nqC+PFN8Wih8YR3aI+LfUA8L5uvxigfjhoEDcrT0tkec13+qJ kGRyCAW/hsl0xzIu2PPZir7FaqJIbMbYNPMrpx9MC1/M6LnmkKyoRPlkdFmdlGQJ4nM7 4N5iM1KvOzqFZ454r1oyaxxooH2munw0YY07q/p0TBExKVAOF8w0RsQZDosb2NjmpcE6 RIxAM83jbx9ePdmX2COS/oKqfCxnURGqFqq0P1c9jXHg2lH3yk3yRRHoaKL0vgNYkZrs ZnAcoGl6mgzBHzlrALBRvtXxAA/AFJswtqZ+Njj51pTiHznS1/p7gnuJkhTqJOciph/n rxdg== X-Gm-Message-State: AKS2vOxLeSt3DKV2ID4gPXf4nKmB5VZAOzykTwaeKyWos2wxFJH0xnjP CmaBT2wKAmFvKkwpQ/IrvQ== X-Received: by 10.55.59.10 with SMTP id i10mr4778227qka.15.1498158850480; Thu, 22 Jun 2017 12:14:10 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 22 Jun 2017 15:14:03 -0400 Message-Id: <20170622191407.15570-4-dzamirski@datto.com> In-Reply-To: <20170622191407.15570-1-dzamirski@datto.com> References: <20170622191407.15570-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 22 Jun 2017 19:14:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 22 Jun 2017 19:14:11 +0000 (UTC) for IP:'209.85.220.176' DOMAIN:'mail-qk0-f176.google.com' HELO:'mail-qk0-f176.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: -0.611 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.220.176 mail-qk0-f176.google.com 209.85.220.176 mail-qk0-f176.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-php PATCH 3/7] update code to use resource handling macros X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 22 Jun 2017 19:15:33 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/libvirt-php.c | 270 ++++++++++++--------------------------------------= ---- 1 file changed, 59 insertions(+), 211 deletions(-) diff --git a/src/libvirt-php.c b/src/libvirt-php.c index ece98d6..73466f1 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -1368,13 +1368,7 @@ int is_local_connection(virConnectPtr conn) } =20 /* Destructor for connection resource */ -static void php_libvirt_connection_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_connection_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_connection *conn =3D (php_libvirt_connection *)rsrc->ptr; int rv =3D 0; @@ -1398,13 +1392,7 @@ static void php_libvirt_connection_dtor( } =20 /* Destructor for domain resource */ -static void php_libvirt_domain_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_domain_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_domain *domain =3D (php_libvirt_domain *)rsrc->ptr; int rv =3D 0; @@ -1432,13 +1420,7 @@ static void php_libvirt_domain_dtor( } =20 /* Destructor for stream resource */ -static void php_libvirt_stream_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_stream_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_stream *stream =3D (php_libvirt_stream *)rsrc->ptr; int rv =3D 0; @@ -1465,13 +1447,7 @@ static void php_libvirt_stream_dtor( } =20 /* Destructor for storagepool resource */ -static void php_libvirt_storagepool_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_storagepool_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_storagepool *pool =3D (php_libvirt_storagepool *)rsrc->ptr; int rv =3D 0; @@ -1498,13 +1474,7 @@ static void php_libvirt_storagepool_dtor( } =20 /* Destructor for volume resource */ -static void php_libvirt_volume_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_volume_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_volume *volume =3D (php_libvirt_volume *)rsrc->ptr; int rv =3D 0; @@ -1531,13 +1501,7 @@ static void php_libvirt_volume_dtor( } =20 /* Destructor for network resource */ -static void php_libvirt_network_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_network_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_network *network =3D (php_libvirt_network *)rsrc->ptr; int rv =3D 0; @@ -1564,13 +1528,7 @@ static void php_libvirt_network_dtor( } =20 /* Destructor for nodedev resource */ -static void php_libvirt_nodedev_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_nodedev_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_nodedev *nodedev =3D (php_libvirt_nodedev *)rsrc->ptr; int rv =3D 0; @@ -1597,13 +1555,7 @@ static void php_libvirt_nodedev_dtor( } =20 /* Destructor for snapshot resource */ -static void php_libvirt_snapshot_dtor( -#if PHP_MAJOR_VERSION >=3D 7 - zend_resource *rsrc -#else - zend_rsrc_list_entry *rsrc -#endif - TSRMLS_DC) +static void php_libvirt_snapshot_dtor(virt_resource *rsrc TSRMLS_DC) { php_libvirt_snapshot *snapshot =3D (php_libvirt_snapshot *)rsrc->ptr; int rv =3D 0; @@ -4198,11 +4150,8 @@ PHP_FUNCTION(libvirt_domain_lookup_by_name) =20 DPRINTF("%s: domain name =3D '%s', returning %p\n", PHPFUNC, name, res= _domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -4236,11 +4185,8 @@ PHP_FUNCTION(libvirt_domain_lookup_by_uuid) =20 DPRINTF("%s: domain UUID =3D '%s', returning %p\n", PHPFUNC, uuid, res= _domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -4304,11 +4250,8 @@ PHP_FUNCTION(libvirt_domain_lookup_by_uuid_string) =20 DPRINTF("%s: domain UUID string =3D '%s', returning %p\n", PHPFUNC, uu= id, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -4342,11 +4285,8 @@ PHP_FUNCTION(libvirt_stream_create) res_stream->conn =3D conn; =20 resource_change_counter(INT_RESOURCE_STREAM, conn->conn, res_stream->s= tream, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_stream, le_libvirt_s= tream)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_stream, le_libvirt_stream); -#endif + + VIRT_REGISTER_RESOURCE(res_stream, le_libvirt_stream); } =20 /* @@ -4533,11 +4473,8 @@ PHP_FUNCTION(libvirt_domain_lookup_by_id) =20 DPRINTF("%s: domain id =3D '%d', returning %p\n", PHPFUNC, (int)id, re= s_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -5644,11 +5581,8 @@ PHP_FUNCTION(libvirt_domain_new) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -5880,11 +5814,8 @@ PHP_FUNCTION(libvirt_domain_change_memory) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -5965,11 +5896,8 @@ PHP_FUNCTION(libvirt_domain_change_boot_devices) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -6618,11 +6546,8 @@ PHP_FUNCTION(libvirt_domain_define_xml) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -6656,11 +6581,8 @@ PHP_FUNCTION(libvirt_domain_create_xml) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_domain->d= omain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -7447,11 +7369,8 @@ PHP_FUNCTION(libvirt_domain_migrate) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_domain->domain); resource_change_counter(INT_RESOURCE_DOMAIN, dconn->conn, res_domain->= domain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_domain, le_libvirt_d= omain)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain); -#endif + + VIRT_REGISTER_RESOURCE(res_domain, le_libvirt_domain); } =20 /* @@ -7547,11 +7466,8 @@ PHP_FUNCTION(libvirt_domain_snapshot_lookup_by_name) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_snapshot->snapshot); resource_change_counter(INT_RESOURCE_SNAPSHOT, domain->conn->conn, res= _snapshot->snapshot, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_snapshot, le_libvirt= _snapshot)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_snapshot, le_libvirt_snapshot= ); -#endif + + VIRT_REGISTER_RESOURCE(res_snapshot, le_libvirt_snapshot); } =20 /* @@ -7583,11 +7499,8 @@ PHP_FUNCTION(libvirt_domain_snapshot_create) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_snapshot->snapshot); resource_change_counter(INT_RESOURCE_SNAPSHOT, domain->conn->conn, res= _snapshot->snapshot, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_snapshot, le_libvirt= _snapshot)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_snapshot, le_libvirt_snapshot= ); -#endif + + VIRT_REGISTER_RESOURCE(res_snapshot, le_libvirt_snapshot); } =20 /* @@ -7737,11 +7650,8 @@ PHP_FUNCTION(libvirt_storagepool_lookup_by_name) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_pool->pool); resource_change_counter(INT_RESOURCE_STORAGEPOOL, conn->conn, res_pool= ->pool, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_pool, le_libvirt_sto= ragepool)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_pool, le_libvirt_storagepool); -#endif + + VIRT_REGISTER_RESOURCE(res_pool, le_libvirt_storagepool); } =20 /* Storagepool functions */ @@ -7773,11 +7683,8 @@ PHP_FUNCTION(libvirt_storagepool_lookup_by_volume) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_pool->pool); resource_change_counter(INT_RESOURCE_STORAGEPOOL, res_pool->conn->conn= , res_pool->pool, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_pool, le_libvirt_sto= ragepool)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_pool, le_libvirt_storagepool); -#endif + + VIRT_REGISTER_RESOURCE(res_pool, le_libvirt_storagepool); } =20 /* @@ -7881,11 +7788,8 @@ PHP_FUNCTION(libvirt_storagevolume_lookup_by_name) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_volume->volume); resource_change_counter(INT_RESOURCE_VOLUME, pool->conn->conn, res_vol= ume->volume, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_volume, le_libvirt_v= olume)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_volume, le_libvirt_volume); -#endif + + VIRT_REGISTER_RESOURCE(res_volume, le_libvirt_volume); } =20 /* @@ -7922,11 +7826,8 @@ PHP_FUNCTION(libvirt_storagevolume_lookup_by_path) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_volume->volume); resource_change_counter(INT_RESOURCE_VOLUME, conn->conn, res_volume->v= olume, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_volume, le_libvirt_v= olume)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_volume, le_libvirt_volume); -#endif + + VIRT_REGISTER_RESOURCE(res_volume, le_libvirt_volume); } =20 /* @@ -8079,11 +7980,8 @@ PHP_FUNCTION(libvirt_storagevolume_create_xml) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_volume->volume); resource_change_counter(INT_RESOURCE_VOLUME, pool->conn->conn, res_vol= ume->volume, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_volume, le_libvirt_v= olume)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_volume, le_libvirt_volume); -#endif + + VIRT_REGISTER_RESOURCE(res_volume, le_libvirt_volume); } =20 /* @@ -8132,11 +8030,8 @@ PHP_FUNCTION(libvirt_storagevolume_create_xml_from) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_volume->volume); resource_change_counter(INT_RESOURCE_VOLUME, pool->conn->conn, res_vol= ume->volume, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_volume, le_libvirt_v= olume)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_volume, le_libvirt_volume); -#endif + + VIRT_REGISTER_RESOURCE(res_volume, le_libvirt_volume); } =20 /* @@ -8361,11 +8256,8 @@ PHP_FUNCTION(libvirt_storagepool_lookup_by_uuid_stri= ng) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_pool->pool); resource_change_counter(INT_RESOURCE_STORAGEPOOL, conn->conn, res_pool= ->pool, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_pool, le_libvirt_sto= ragepool)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_pool, le_libvirt_storagepool); -#endif + + VIRT_REGISTER_RESOURCE(res_pool, le_libvirt_storagepool); } =20 /* @@ -8443,11 +8335,8 @@ PHP_FUNCTION(libvirt_storagepool_define_xml) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_pool->pool); resource_change_counter(INT_RESOURCE_STORAGEPOOL, conn->conn, res_pool= ->pool, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_pool, le_libvirt_sto= ragepool)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_pool, le_libvirt_storagepool); -#endif + + VIRT_REGISTER_RESOURCE(res_pool, le_libvirt_storagepool); } =20 /* @@ -8883,11 +8772,6 @@ PHP_FUNCTION(libvirt_list_domain_resources) { php_libvirt_connection *conn =3D NULL; zval *zconn; -#if PHP_MAJOR_VERSION >=3D 7 - zval zdomain; -#else - zval *zdomain; -#endif int count =3D -1; int expectedcount =3D -1; int *ids; @@ -8917,15 +8801,8 @@ PHP_FUNCTION(libvirt_list_domain_resources) =20 res_domain->conn =3D conn; =20 + VIRT_REGISTER_LIST_RESOURCE(domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_d= omain->domain, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(&zdomain, zend_register_resource(res_domain, le_libvi= rt_domain)); - add_next_index_zval(return_value, &zdomain); -#else - ALLOC_INIT_ZVAL(zdomain); - ZEND_REGISTER_RESOURCE(zdomain, res_domain, le_libvirt_domain); - add_next_index_zval(return_value, zdomain); -#endif } } efree(ids); @@ -8947,14 +8824,7 @@ PHP_FUNCTION(libvirt_list_domain_resources) =20 res_domain->conn =3D conn; =20 -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(&zdomain, zend_register_resource(res_domain, le_libvi= rt_domain)); - add_next_index_zval(return_value, &zdomain); -#else - ALLOC_INIT_ZVAL(zdomain); - ZEND_REGISTER_RESOURCE(zdomain, res_domain, le_libvirt_domain); - add_next_index_zval(return_value, zdomain); -#endif + VIRT_REGISTER_LIST_RESOURCE(domain); resource_change_counter(INT_RESOURCE_DOMAIN, conn->conn, res_d= omain->domain, 1 TSRMLS_CC); } free(names[i]); @@ -9091,11 +8961,6 @@ PHP_FUNCTION(libvirt_list_all_networks) { php_libvirt_connection *conn =3D NULL; zval *zconn; -#if PHP_MAJOR_VERSION >=3D 7 - zval znetwork; -#else - zval *znetwork; -#endif zend_long flags =3D VIR_CONNECT_LIST_NETWORKS_ACTIVE | VIR_CONNECT_LIST_NETWORKS_INACTIVE; int count =3D -1; @@ -9119,17 +8984,9 @@ PHP_FUNCTION(libvirt_list_all_networks) res_network->network =3D network; res_network->conn =3D conn; =20 + VIRT_REGISTER_LIST_RESOURCE(network); resource_change_counter(INT_RESOURCE_NETWORK, conn->conn, res_network->network, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(&znetwork, zend_register_resource(res_network, - le_libvirt_network)); - add_next_index_zval(return_value, &znetwork); -#else - ALLOC_INIT_ZVAL(znetwork); - ZEND_REGISTER_RESOURCE(znetwork, res_network, le_libvirt_network); - add_next_index_zval(return_value, znetwork); -#endif } } =20 @@ -9267,11 +9124,8 @@ PHP_FUNCTION(libvirt_nodedev_get) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_dev->device); resource_change_counter(INT_RESOURCE_NODEDEV, conn->conn, res_dev->dev= ice, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_dev, le_libvirt_node= dev)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_dev, le_libvirt_nodedev); -#endif + + VIRT_REGISTER_RESOURCE(res_dev, le_libvirt_nodedev); } =20 /* @@ -9534,11 +9388,8 @@ PHP_FUNCTION(libvirt_network_define_xml) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_net->network); resource_change_counter(INT_RESOURCE_NETWORK, conn->conn, res_net->net= work, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_net, le_libvirt_netw= ork)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_net, le_libvirt_network); -#endif + + VIRT_REGISTER_RESOURCE(res_net, le_libvirt_network); } =20 /* @@ -9591,11 +9442,8 @@ PHP_FUNCTION(libvirt_network_get) =20 DPRINTF("%s: returning %p\n", PHPFUNC, res_net->network); resource_change_counter(INT_RESOURCE_NETWORK, conn->conn, res_net->net= work, 1 TSRMLS_CC); -#if PHP_MAJOR_VERSION >=3D 7 - ZVAL_RES(return_value, zend_register_resource(res_net, le_libvirt_netw= ork)); -#else - ZEND_REGISTER_RESOURCE(return_value, res_net, le_libvirt_network); -#endif + + VIRT_REGISTER_RESOURCE(res_net, le_libvirt_network); } =20 /* --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list