Re: [libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node

2019-02-27 Thread Eric Blake
On 2/27/19 3:27 AM, Peter Krempa wrote: >>> + * node pointer is reset to the original value when this macro was used. >>> + */ >>> +# define VIR_XPATH_NODE_AUTORESTORE(ctxt) \ >>> +VIR_AUTOCLEAN(virXPathContextNodeSave) ctxt ## CtxtSave = {(ctxt), >>> (ctxt)->node} >> >> Worth using C99 synta

Re: [libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node

2019-02-27 Thread Ján Tomko
On Tue, Feb 26, 2019 at 06:08:11PM +0100, Peter Krempa wrote: Quite a few parts modify the XPath context current node to shif the shift 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

Re: [libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node

2019-02-27 Thread Peter Krempa
On Tue, Feb 26, 2019 at 11:29:33 -0600, Eric Blake wrote: > On 2/26/19 11:08 AM, Peter Krempa wrote: > > Quite a few parts modify the XPath context current node to shif the > > shift > > > scope and allow easier queries. This also means that the node needs > > to be restored afterwards. > > > >

Re: [libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node

2019-02-26 Thread Peter Krempa
On Tue, Feb 26, 2019 at 18:08:11 +0100, Peter Krempa wrote: > 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 str

Re: [libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node

2019-02-26 Thread Eric Blake
On 2/26/19 11:08 AM, Peter Krempa wrote: > Quite a few parts modify the XPath context current node to shif the shift > 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

[libvirt] [PATCH 4/5] util: XML: Introduce automatic reset of XPath's current node

2019-02-26 Thread Peter Krempa
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 functio