After commit
b0be2b12 ("libxl: fix libxl_string_list_length and its only
caller") libxl_string_list_length no longer handles null (empty) lists. Fix
so they are handled, returning length 0.
While at it, remove the unneccessary undereferenced null pointer check
and tidy the layout of the function.
Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
int libxl_string_list_length(const libxl_string_list *psl)
{
- if (!psl) return 0;
int i = 0;
- while ((*psl)[i]) i++;
+
+ if (*psl)
+ while ((*psl)[i])
+ i++;
+
return i;
}