Some callers don't need to know the actual lenght of the list but only
care whether the required element is present or the list is non-empty.
Don't calculate the list length in those cases.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
family = AF_INET6;
ipparts = virStringSplit(value->str, "/", 2);
- if (virStringListLength((const char * const *)ipparts) != 2 ||
+ if (!ipparts || !ipparts[0] || !ipparts[1] ||
virSocketAddrParse(&ip->address, ipparts[0], family) < 0 ||
virStrToLong_ui(ipparts[1], NULL, 10, &ip->prefix) < 0) {
return -1;
}
- if (virStringListLength((const char * const *)features) == 0)
+ if (!features || !*features)
return 0;
for (i = 0; i < dom->def->nresctrls; i++) {
cells = virStringSplit(lines[i], " ", 0);
- if (cells != NULL &&
- virStringListLength((const char * const *)cells) > 2) {
+ if (cells != NULL && cells[0] && cells[1]) {
if (virStorageBackendSheepdogAddVolume(pool, cells[1]) < 0)
return -1;
}