[PATCH v2 02/11] virXMLNodeGetSubelementList: Document return value semantics

Peter Krempa posted 11 patches 1 week, 1 day ago
[PATCH v2 02/11] virXMLNodeGetSubelementList: Document return value semantics
Posted by Peter Krempa 1 week, 1 day ago
The returned value is always non-NULL. Callers need to check the lenght
of the returned array instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/util/virxml.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/virxml.c b/src/util/virxml.c
index 670cace4ab..d5c7ebaf22 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -909,6 +909,8 @@ virXMLNodeGetSubelement(xmlNodePtr node,
  * Find and return a sub-elements node of @node named @name in a GPtrArray
  * populated with the xmlNodePtr objects. Caller is responsible for freeing the
  * array but not the contained xmlNode objects.
+ *
+ * Note: The returned GPtrArray is non-NULL even if @node doesn't contain such sub-elements
  */
 GPtrArray *
 virXMLNodeGetSubelementList(xmlNodePtr node,
-- 
2.48.1
Re: [PATCH v2 02/11] virXMLNodeGetSubelementList: Document return value semantics
Posted by Ján Tomko 21 hours ago
On a Monday in 2025, Peter Krempa wrote:
>The returned value is always non-NULL. Callers need to check the lenght

length

>of the returned array instead.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/util/virxml.c | 2 ++
> 1 file changed, 2 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano