On 08/19/2011 02:48 AM, Daniel Veillard wrote:
+ * Return the parsed document object, or NULL on failure.
+ */
+# define virXMLParseFileCtxt(filename, pctxt) \
+ virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, pctxt)
#endif /* __VIR_XML_H__ */
ACK to the overall cleanup, I'm just a bit dubious about
xmlXPathContextPtr initialization in the helper, as I like to have
allocations and frees matched to the same level. It's easier to forget
to free the context if one doesn't "see" it allocated. But it's a minor
concern.
I think you can still "see" the allocations - it's just that virXMLParse
does one allocation (return value), while virXMLParseCtxt does two
allocations (return value, and allocation into passed pointer). Yes, it
does mean that one virXMLParseCtxt call results in two separate free
calls, but hopefully we don't introduce leaks because of it, and coding
by copy-paste should still work at cleaning both variables.
At any rate, I've now pushed the series.
--
Eric Blake eblake@xxxxxxxxxx +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list