From nobody Mon Apr 29 20:41:26 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551200909879127.85420913077598; Tue, 26 Feb 2019 09:08:29 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C0AD59465; Tue, 26 Feb 2019 17:08:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07EF45D9CC; Tue, 26 Feb 2019 17:08:28 +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 C256A3FA4A; Tue, 26 Feb 2019 17:08:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1QH8IZ9029478 for ; Tue, 26 Feb 2019 12:08:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9FD405D6B6; Tue, 26 Feb 2019 17:08:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEF7B5D6AA; Tue, 26 Feb 2019 17:08:17 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Feb 2019 18:08:08 +0100 Message-Id: <4e34544d57418a0fe23d0a7b629212c90390cad0.1551200849.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/5] cfg: Add VIR_AUTO(UNREF|CLEAN|STRINGLIST) to sc_requirere_attribute_cleanup_initialization 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: , 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 26 Feb 2019 17:08:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The syntaxcheck should also check the new ones. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- cfg.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg.mk b/cfg.mk index 7762422da7..f99b8ae631 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1070,7 +1070,7 @@ sc_prohibit_backslash_alignment: # Rule to ensure that variables declared using a cleanup macro are # always initialized. sc_require_attribute_cleanup_initialization: - @prohibit=3D'VIR_AUTO((FREE|PTR)\(.+\)|CLOSE) *[^=3D]+;' \ + @prohibit=3D'VIR_AUTO((FREE|PTR|UNREF|CLEAN)\(.+\)|CLOSE|STRINGLIST) *[^= =3D]+;' \ in_vc_files=3D'\.[chx]$$' \ halt=3D'variable declared with a cleanup macro must be initialized' \ $(_sc_search_regexp) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:41:26 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155120091470626.205915598042225; Tue, 26 Feb 2019 09:08:34 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEAC85AFF4; Tue, 26 Feb 2019 17:08:31 +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 C2B601001DE1; Tue, 26 Feb 2019 17:08:31 +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 851FD181A010; Tue, 26 Feb 2019 17:08:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1QH8Jxr029486 for ; Tue, 26 Feb 2019 12:08:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9FA0E5D71F; Tue, 26 Feb 2019 17:08:19 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF5805D6AA; Tue, 26 Feb 2019 17:08:18 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Feb 2019 18:08:09 +0100 Message-Id: <1148f339b1b5dbf30ac8d6a4866d04696dfe8cf6.1551200849.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/5] util: object: Reset pointer when unrefing object in virObjectAutoUnref 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 26 Feb 2019 17:08:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The helper function is used by the VIR_AUTOUNREF macro. Prior art is to clear the pointer even if the variable goes out of scope. Signed-off-by: Peter Krempa --- src/util/virobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virobject.c b/src/util/virobject.c index a4cbd08077..f08c18ce44 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -372,6 +372,7 @@ virObjectAutoUnref(void *objptr) { virObjectPtr *obj =3D objptr; virObjectUnref(*obj); + *obj =3D NULL; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:41:26 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551200917410116.62487204885838; Tue, 26 Feb 2019 09:08:37 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B480530A696E; Tue, 26 Feb 2019 17:08:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88F3628D3A; Tue, 26 Feb 2019 17:08:35 +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 47ADC3FA4B; Tue, 26 Feb 2019 17:08:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1QH8KnJ029493 for ; Tue, 26 Feb 2019 12:08:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F3F05D720; Tue, 26 Feb 2019 17:08:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEE075D6B3; Tue, 26 Feb 2019 17:08:19 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Feb 2019 18:08:10 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/5] util: alloc: Clarify docs for VIR_DEFINE_AUTOCLEAN_FUNC 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 26 Feb 2019 17:08:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Document that @func must take pointer to @type. Signed-off-by: Peter Krempa --- src/util/viralloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 15451d4673..cecabc246c 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -623,8 +623,8 @@ void virAllocTestHook(void (*func)(int, void*), void *d= ata); * @func: cleanup function to be automatically called * * This macro defines a function for automatic clearing of - * resources in a stack'd variable of type @type. This newly - * defined function works as a necessary wrapper around @func. + * resources in a stack'd variable of type @type. Note that @func must + * take pointer to @type. */ # define VIR_DEFINE_AUTOCLEAN_FUNC(type, func) \ static inline void VIR_AUTOCLEAN_FUNC_NAME(type)(type *_ptr) \ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:41:26 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551200907400480.5697355811395; Tue, 26 Feb 2019 09:08:27 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99FC6A82C; Tue, 26 Feb 2019 17:08:25 +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 6961A67667; Tue, 26 Feb 2019 17:08:25 +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 021FA181A00A; Tue, 26 Feb 2019 17:08:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1QH8LA0029501 for ; Tue, 26 Feb 2019 12:08:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id A088A5D71F; Tue, 26 Feb 2019 17:08:21 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF7B65D6B3; Tue, 26 Feb 2019 17:08:20 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Feb 2019 18:08:11 +0100 Message-Id: <5c70d6a5a162c3de519340b21d0352cf967ab8a5.1551200849.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 26 Feb 2019 17:08:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Quite a few parts modify the XPath context current node to shif the scope and allow easier queries. This also means that the node needs to be restored afterwards. Introduce a macro based on 'VIR_AUTOCLEAN' which adds a local structure on the stack remembering the original node along with a function which will make sure that the node is reset when the local structure leaves scope. Signed-off-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virxml.c | 10 ++++++++++ src/util/virxml.h | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 038a744981..ee5d9957b0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3246,6 +3246,7 @@ virXMLValidatorFree; virXMLValidatorInit; virXMLValidatorValidate; virXPathBoolean; +virXPathContextNodeRestore; virXPathInt; virXPathLong; virXPathLongHex; diff --git a/src/util/virxml.c b/src/util/virxml.c index 8eb201fddf..f55b9a362c 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1398,3 +1398,13 @@ virXMLFormatElement(virBufferPtr buf, virBufferFreeAndReset(childBuf); return ret; } + + +void +virXPathContextNodeRestore(virXPathContextNodeSavePtr save) +{ + if (!save->ctxt) + return; + + save->ctxt->node =3D save->node; +} diff --git a/src/util/virxml.h b/src/util/virxml.h index 23a4da1b7e..1bd2c0e518 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -219,4 +219,26 @@ virXMLFormatElement(virBufferPtr buf, virBufferPtr attrBuf, virBufferPtr childBuf); +struct _virXPathContextNodeSave { + xmlXPathContextPtr ctxt; + xmlNodePtr node; +}; +typedef struct _virXPathContextNodeSave virXPathContextNodeSave; +typedef virXPathContextNodeSave *virXPathContextNodeSavePtr; + +void +virXPathContextNodeRestore(virXPathContextNodeSavePtr save); + +VIR_DEFINE_AUTOCLEAN_FUNC(virXPathContextNodeSave, virXPathContextNodeRest= ore); + +/** + * VIR_XPATH_NODE_AUTORESTORE: + * @ctxt: XML XPath context pointer + * + * This macro ensures that when the scope where it's used ends @ctxt's cur= rent + * node pointer is reset to the original value when this macro was used. + */ +# define VIR_XPATH_NODE_AUTORESTORE(ctxt) \ + VIR_AUTOCLEAN(virXPathContextNodeSave) ctxt ## CtxtSave =3D {(ctxt), (= ctxt)->node} + #endif /* LIBVIRT_VIRXML_H */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:41:26 2024 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551200908099524.8379456640149; Tue, 26 Feb 2019 09:08:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDE8189AD8; Tue, 26 Feb 2019 17:08:25 +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 B16D26606A; Tue, 26 Feb 2019 17:08:25 +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 63872181A00B; Tue, 26 Feb 2019 17:08:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1QH8M91029513 for ; Tue, 26 Feb 2019 12:08:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id A00C65D71F; Tue, 26 Feb 2019 17:08:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id F05E85D6B6; Tue, 26 Feb 2019 17:08:21 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 26 Feb 2019 18:08:12 +0100 Message-Id: <5a5eaa894296b83c8ae3c58f42d1e936422c8806.1551200849.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 5/5] qemu: Use VIR_XPATH_NODE_AUTORESTORE when XPath context is modified 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 26 Feb 2019 17:08:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use the new helper when moving around the current node of the XPath context. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_domain.c | 6 ++---- src/qemu/qemu_migration_cookie.c | 9 +++------ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b48bcbebee..1d1bb80b39 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3042,7 +3042,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCa= ps, char *str =3D NULL; xmlNodePtr hostCPUNode; xmlNodePtr *nodes =3D NULL; - xmlNodePtr oldnode =3D ctxt->node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); qemuMonitorCPUModelInfoPtr hostCPU =3D NULL; int ret =3D -1; size_t i; @@ -3160,7 +3160,6 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCa= ps, ret =3D 0; cleanup: - ctxt->node =3D oldnode; VIR_FREE(str); VIR_FREE(nodes); qemuMonitorCPUModelInfoFree(hostCPU); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 59fe1eb401..690a57521e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2717,7 +2717,7 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr n= ode, xmlXPathContextPtr ctxt, virDomainDiskDefPtr disk) { - xmlNodePtr savedNode =3D ctxt->node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); char *format =3D NULL; char *type =3D NULL; @@ -2772,7 +2772,6 @@ qemuDomainObjPrivateXMLParseJobNBDSource(xmlNodePtr n= ode, cleanup: VIR_FREE(format); VIR_FREE(type); - ctxt->node =3D savedNode; return ret; } @@ -2827,7 +2826,7 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv, xmlXPathContextPtr ctxt) { - xmlNodePtr savedNode =3D ctxt->node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); char *tmp =3D NULL; int ret =3D -1; @@ -2884,7 +2883,6 @@ qemuDomainObjPrivateXMLParseJob(virDomainObjPtr vm, ret =3D 0; cleanup: - ctxt->node =3D savedNode; VIR_FREE(tmp); return ret; } diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index ae2546f98b..74b8575a91 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -946,7 +946,7 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr c= txt) int n; xmlNodePtr *interfaces =3D NULL; char *vporttype; - xmlNodePtr save_ctxt =3D ctxt->node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); if (VIR_ALLOC(optr) < 0) goto error; @@ -978,7 +978,6 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr c= txt) VIR_FREE(interfaces); cleanup: - ctxt->node =3D save_ctxt; return optr; error: @@ -997,7 +996,7 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctxt) size_t i; int n; xmlNodePtr *disks =3D NULL; - xmlNodePtr save_ctxt =3D ctxt->node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); if (VIR_ALLOC(ret) < 0) goto error; @@ -1044,7 +1043,6 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctx= t) VIR_FREE(port); VIR_FREE(capacity); VIR_FREE(disks); - ctxt->node =3D save_ctxt; return ret; error: qemuMigrationCookieNBDFree(ret); @@ -1058,7 +1056,7 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContext= Ptr ctxt) { qemuDomainJobInfoPtr jobInfo =3D NULL; qemuMonitorMigrationStats *stats; - xmlNodePtr save_ctxt =3D ctxt->node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); if (!(ctxt->node =3D virXPathNode("./statistics", ctxt))) goto cleanup; @@ -1136,7 +1134,6 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContext= Ptr ctxt) virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])", ctxt, &stats->cpu_throttle_percentage); cleanup: - ctxt->node =3D save_ctxt; return jobInfo; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list