We have couple of functions that operate over NULL terminated lits of strings. However, our naming sucks: virStringJoin virStringFreeList virStringFreeListCount virStringArrayHasString virStringGetFirstWithPrefix We can do better: virStringListJoin virStringListFree virStringListFreeCount virStringListHasString virStringListGetFirstWithPrefix Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- daemon/remote.c | 2 +- src/bhyve/bhyve_command.c | 2 +- src/bhyve/bhyve_parse_command.c | 14 +++++++------- src/conf/domain_capabilities.c | 2 +- src/cpu/cpu_ppc64.c | 2 +- src/cpu/cpu_x86.c | 2 +- src/libvirt_private.syms | 10 +++++----- src/lxc/lxc_container.c | 2 +- src/lxc/lxc_native.c | 24 ++++++++++++------------ src/openvz/openvz_conf.c | 2 +- src/qemu/qemu_agent.c | 4 ++-- src/qemu/qemu_capabilities.c | 20 ++++++++++---------- src/qemu/qemu_conf.c | 10 +++++----- src/qemu/qemu_domain.c | 6 +++--- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_monitor_json.c | 18 +++++++++--------- src/qemu/qemu_monitor_text.c | 6 +++--- src/qemu/qemu_parse_command.c | 22 +++++++++++----------- src/qemu/qemu_process.c | 8 ++++---- src/remote/remote_driver.c | 2 +- src/storage/storage_backend_sheepdog.c | 6 +++--- src/storage/storage_backend_zfs.c | 12 ++++++------ src/storage/storage_driver.c | 2 +- src/util/vircgroup.c | 8 ++++---- src/util/vircommand.c | 2 +- src/util/virconf.c | 4 ++-- src/util/virfile.c | 6 +++--- src/util/virfirewall.c | 2 +- src/util/virfirmware.c | 4 ++-- src/util/virlog.c | 8 ++++---- src/util/virpolkit.c | 2 +- src/util/virprocess.c | 2 +- src/util/virstoragefile.c | 16 ++++++++-------- src/util/virstring.c | 32 ++++++++++++++++---------------- src/util/virstring.h | 12 ++++++------ src/util/viruri.c | 2 +- src/vbox/vbox_common.c | 10 +++++----- src/vbox/vbox_snapshot_conf.c | 18 +++++++++--------- src/vz/vz_sdk.c | 2 +- tests/domainsnapshotxml2xmltest.c | 2 +- tests/qemumonitorjsontest.c | 14 +++++++------- tests/qemuxml2argvtest.c | 2 +- tests/vboxsnapshotxmltest.c | 2 +- tests/virconftest.c | 2 +- tests/virfiletest.c | 2 +- tests/virpolkittest.c | 2 +- tests/virstringtest.c | 14 +++++++------- tools/virsh-domain.c | 12 ++++++------ tools/virsh-nodedev.c | 6 +++--- tools/virsh-pool.c | 4 ++-- tools/virsh-snapshot.c | 4 ++-- tools/virt-host-validate-common.c | 6 +++--- tools/virt-login-shell.c | 6 +++--- tools/vsh.c | 4 ++-- 54 files changed, 196 insertions(+), 196 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index e414f92..46773da 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -5425,7 +5425,7 @@ remoteDispatchConnectGetCPUModelNames(virNetServerPtr server ATTRIBUTE_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virStringFreeList(models); + virStringListFree(models); return rv; } diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index bb5c45c..8a29977 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -323,7 +323,7 @@ virAppendBootloaderArgs(virCommandPtr cmd, virDomainDefPtr def) /* XXX: Handle quoted? */ blargs = virStringSplit(def->os.bootloaderArgs, " ", 0); virCommandAddArgSet(cmd, (const char * const *)blargs); - virStringFreeList(blargs); + virStringListFree(blargs); } static virCommandPtr diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c index 0ae7a83..6190042 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -246,7 +246,7 @@ bhyveCommandLineToArgv(const char *nativeConfig, } else { /* To prevent a use-after-free here, only free the argument list * when it is definitely not going to be used */ - virStringFreeList(arglist); + virStringListFree(arglist); } } @@ -254,13 +254,13 @@ bhyveCommandLineToArgv(const char *nativeConfig, if (!(*bhyve_argv = _bhyve_argv)) goto error; - virStringFreeList(lines); + virStringListFree(lines); return 0; error: VIR_FREE(_loader_argv); VIR_FREE(_bhyve_argv); - virStringFreeList(lines); + virStringListFree(lines); return -1; } @@ -804,7 +804,7 @@ bhyveParseBhyveLoadCommandLine(virDomainDefPtr def, if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0) goto error; - def->os.bootloaderArgs = virStringJoin((const char**) &argv[1], " "); + def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " "); } if (argc != parser->optind) { @@ -841,7 +841,7 @@ bhyveParseCustomLoaderCommandLine(virDomainDefPtr def, if (VIR_STRDUP(def->os.bootloader, argv[0]) < 0) goto error; - def->os.bootloaderArgs = virStringJoin((const char**) &argv[1], " "); + def->os.bootloaderArgs = virStringListJoin((const char**) &argv[1], " "); return 0; error: @@ -893,8 +893,8 @@ bhyveParseCommandLineString(const char* nativeConfig, } cleanup: - virStringFreeList(loader_argv); - virStringFreeList(bhyve_argv); + virStringListFree(loader_argv); + virStringListFree(bhyve_argv); return def; error: virDomainDefFree(def); diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index beedd70..fb2d696 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -185,7 +185,7 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old, return NULL; for (i = 0; i < old->nmodels; i++) { - if (models && !virStringArrayHasString(models, old->models[i].name)) + if (models && !virStringListHasString(models, old->models[i].name)) continue; if (virDomainCapsCPUModelsAdd(cpuModels, diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 225fb6d..180ad87 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -888,7 +888,7 @@ virCPUppc64DriverGetModels(char ***models) error: if (models) { - virStringFreeList(*models); + virStringListFree(*models); *models = NULL; } goto cleanup; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index e91850f..c79308a 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2675,7 +2675,7 @@ virCPUx86GetModels(char ***models) error: if (models) { - virStringFreeList(*models); + virStringListFree(*models); *models = NULL; } return -1; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a04ba23..7cc7bf8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2453,16 +2453,16 @@ virSkipSpacesAndBackslash; virSkipSpacesBackwards; virStrcpy; virStrdup; -virStringArrayHasString; virStringBufferIsPrintable; virStringEncodeBase64; -virStringFreeList; -virStringFreeListCount; -virStringGetFirstWithPrefix; virStringHasControlChars; virStringIsEmpty; virStringIsPrintable; -virStringJoin; +virStringListFree; +virStringListFreeCount; +virStringListGetFirstWithPrefix; +virStringListHasString; +virStringListJoin; virStringListLength; virStringReplace; virStringSearch; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 5357df4..dd013df 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -607,7 +607,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, ret = 0; cleanup: - virStringFreeList(mounts); + virStringListFree(mounts); return ret; } diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index ce62df9..8f44168 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -129,13 +129,13 @@ static char ** lxcStringSplit(const char *string) } VIR_FREE(tmp); - virStringFreeList(parts); + virStringListFree(parts); return result; error: VIR_FREE(tmp); - virStringFreeList(parts); - virStringFreeList(result); + virStringListFree(parts); + virStringListFree(result); return NULL; } @@ -160,13 +160,13 @@ lxcParseFstabLine(char *fstabLine) VIR_STRDUP(fstab->options, parts[3]) < 0) goto error; - virStringFreeList(parts); + virStringListFree(parts); return fstab; error: lxcFstabFree(fstab); - virStringFreeList(parts); + virStringListFree(parts); return NULL; } @@ -299,7 +299,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab) type = VIR_DOMAIN_FS_TYPE_BLOCK; /* Do we have ro in options? */ - readonly = virStringArrayHasString((const char **) options, "ro"); + readonly = virStringListHasString((const char **) options, "ro"); if (lxcAddFSDef(def, type, src, dst, readonly, usage) < 0) goto cleanup; @@ -308,7 +308,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab) cleanup: VIR_FREE(dst); - virStringFreeList(options); + virStringListFree(options); return ret; } @@ -618,12 +618,12 @@ lxcNetworkWalkCallback(const char *name, virConfValuePtr value, void *data) virReportError(VIR_ERR_INVALID_ARG, _("Invalid CIDR address: '%s'"), value->str); - virStringFreeList(ipparts); + virStringListFree(ipparts); VIR_FREE(ip); return -1; } - virStringFreeList(ipparts); + virStringListFree(ipparts); if (VIR_APPEND_ELEMENT(parseData->ips, parseData->nips, ip) < 0) { VIR_FREE(ip); @@ -943,7 +943,7 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data) ret = 0; cleanup: - virStringFreeList(parts); + virStringListFree(parts); VIR_FREE(path); return ret; @@ -982,13 +982,13 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties) for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) { capString = virDomainCapsFeatureTypeToString(i); if (toDrop != NULL && - virStringArrayHasString((const char **) toDrop, capString)) + virStringListHasString((const char **) toDrop, capString)) def->caps_features[i] = VIR_TRISTATE_SWITCH_OFF; } def->features[VIR_DOMAIN_FEATURE_CAPABILITIES] = VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW; - virStringFreeList(toDrop); + virStringListFree(toDrop); } virDomainDefPtr diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 65c441e..b02e1aa 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -151,7 +151,7 @@ openvzParseBarrierLimit(const char* value, ret = 0; error: - virStringFreeListCount(tmp, ntmp); + virStringListFreeCount(tmp, ntmp); return ret; } diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index ec8d47e..1d677f7 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -2115,7 +2115,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon, } /* Has to be freed for each interface. */ - virStringFreeList(ifname); + virStringListFree(ifname); /* as well as IP address which - moreover - * can be presented multiple times */ @@ -2201,7 +2201,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon, virDomainInterfaceFree(ifaces_ret[i]); } VIR_FREE(ifaces_ret); - virStringFreeList(ifname); + virStringListFree(ifname); goto cleanup; } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f9e39a3..8901e7b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1842,7 +1842,7 @@ virQEMUCapsProcessProps(virQEMUCapsPtr qemuCaps, for (j = 0; j < nvalues; j++) { if (STREQ(values[j], props[i].prop)) { - if (virStringArrayHasString(props[i].objects, object)) + if (virStringListHasString(props[i].objects, object)) virQEMUCapsSet(qemuCaps, props[i].flag); break; } @@ -2369,7 +2369,7 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps, return 0; error: - virStringFreeListCount(models, i); + virStringListFreeCount(models, i); return -1; } @@ -2777,12 +2777,12 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMModelsToCaps); i++) { const char *needle = virDomainTPMModelTypeToString( virQEMUCapsTPMModelsToCaps[i].type); - if (virStringArrayHasString((const char **) entries, needle)) + if (virStringListHasString((const char **) entries, needle)) virQEMUCapsSet(qemuCaps, virQEMUCapsTPMModelsToCaps[i].caps); } } - virStringFreeList(entries); + virStringListFree(entries); if ((nentries = qemuMonitorGetTPMTypes(mon, &entries)) < 0) return -1; @@ -2791,11 +2791,11 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsTPMTypesToCaps); i++) { const char *needle = virDomainTPMBackendTypeToString( virQEMUCapsTPMTypesToCaps[i].type); - if (virStringArrayHasString((const char **) entries, needle)) + if (virStringListHasString((const char **) entries, needle)) virQEMUCapsSet(qemuCaps, virQEMUCapsTPMTypesToCaps[i].caps); } } - virStringFreeList(entries); + virStringListFree(entries); return 0; } @@ -2887,7 +2887,7 @@ virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps, break; } } - virStringFreeList(values); + virStringListFree(values); } return 0; @@ -3849,13 +3849,13 @@ virQEMUCapsQMPSchemaGetByPath(const char *query, if (!*elems) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed query string")); - virStringFreeList(elems); + virStringListFree(elems); return -1; } *entry = virQEMUCapsQMPSchemaTraverse(*elems, elems + 1, schema); - virStringFreeList(elems); + virStringListFree(elems); return 0; } @@ -4644,7 +4644,7 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, if (virCPUGetModels(domCaps->arch, &models) >= 0) { filtered = virDomainCapsCPUModelsFilter(qemuCaps->cpuDefinitions, (const char **) models); - virStringFreeList(models); + virStringListFree(models); } domCaps->cpu.custom = filtered; } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index fbac3ea..ccefbe8 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -350,7 +350,7 @@ static void virQEMUDriverConfigDispose(void *obj) virQEMUDriverConfigPtr cfg = obj; - virStringFreeList(cfg->cgroupDeviceACL); + virStringListFree(cfg->cgroupDeviceACL); VIR_FREE(cfg->configBaseDir); VIR_FREE(cfg->configDir); @@ -392,7 +392,7 @@ static void virQEMUDriverConfigDispose(void *obj) VIR_FREE(cfg->dumpImageFormat); VIR_FREE(cfg->autoDumpPath); - virStringFreeList(cfg->securityDriverNames); + virStringListFree(cfg->securityDriverNames); VIR_FREE(cfg->lockManagerName); @@ -801,9 +801,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, ret = 0; cleanup: - virStringFreeList(controllers); - virStringFreeList(hugetlbfs); - virStringFreeList(nvram); + virStringListFree(controllers); + virStringListFree(hugetlbfs); + virStringListFree(nvram); VIR_FREE(corestr); VIR_FREE(user); VIR_FREE(group); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 137d4d5..47332a8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1549,7 +1549,7 @@ qemuDomainObjPrivateFree(void *data) VIR_FREE(priv->lockState); VIR_FREE(priv->origname); - virStringFreeList(priv->qemuDevices); + virStringListFree(priv->qemuDevices); virChrdevFree(priv->devs); /* This should never be non-NULL if we get here, but just in case... */ @@ -1963,7 +1963,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, priv->monConfig = NULL; VIR_FREE(nodes); VIR_FREE(tmp); - virStringFreeList(priv->qemuDevices); + virStringListFree(priv->qemuDevices); priv->qemuDevices = NULL; virObjectUnref(qemuCaps); virObjectUnref(caps); @@ -5263,7 +5263,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, if (rc < 0) return -1; - virStringFreeList(priv->qemuDevices); + virStringListFree(priv->qemuDevices); priv->qemuDevices = aliases; return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fdfe912..76f965d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1383,7 +1383,7 @@ qemuGetSchedInfo(unsigned long long *cpuWait, cleanup: VIR_FREE(data); VIR_FREE(proc); - virStringFreeList(lines); + virStringListFree(lines); return ret; } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 90d74d5..03a5e1e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4987,7 +4987,7 @@ int qemuMonitorJSONGetCommands(qemuMonitorPtr mon, cleanup: - virStringFreeList(commandlist); + virStringListFree(commandlist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -5051,7 +5051,7 @@ int qemuMonitorJSONGetEvents(qemuMonitorPtr mon, eventlist = NULL; cleanup: - virStringFreeList(eventlist); + virStringListFree(eventlist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -5173,7 +5173,7 @@ qemuMonitorJSONGetCommandLineOptionParameters(qemuMonitorPtr mon, if (!qemuMonitorGetOptions(mon)) qemuMonitorSetOptions(mon, virJSONValueNewArray()); - virStringFreeList(paramlist); + virStringListFree(paramlist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -5276,7 +5276,7 @@ int qemuMonitorJSONGetObjectTypes(qemuMonitorPtr mon, typelist = NULL; cleanup: - virStringFreeList(typelist); + virStringListFree(typelist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -5577,7 +5577,7 @@ int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, proplist = NULL; cleanup: - virStringFreeList(proplist); + virStringListFree(proplist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -5683,7 +5683,7 @@ qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon, list = NULL; cleanup: - virStringFreeList(list); + virStringListFree(list); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -5701,9 +5701,9 @@ qemuMonitorJSONGetMigrationCapability(qemuMonitorPtr mon, if (qemuMonitorJSONGetMigrationCapabilities(mon, &capsList) < 0) return -1; - ret = virStringArrayHasString((const char **) capsList, cap); + ret = virStringListHasString((const char **) capsList, cap); - virStringFreeList(capsList); + virStringListFree(capsList); return ret; } @@ -6067,7 +6067,7 @@ qemuMonitorJSONGetStringArray(qemuMonitorPtr mon, const char *qmpCmd, list = NULL; cleanup: - virStringFreeList(list); + virStringListFree(list); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 4692d53..a2a5885 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -971,15 +971,15 @@ qemuMonitorTextGetAllBlockStatsInfo(qemuMonitorPtr mon, goto cleanup; stats = NULL; - virStringFreeList(values); + virStringListFree(values); values = NULL; } ret = maxstats; cleanup: - virStringFreeList(lines); - virStringFreeList(values); + virStringListFree(lines); + virStringListFree(values); VIR_FREE(stats); VIR_FREE(info); return ret; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index cfebcc7..405e655 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -360,7 +360,7 @@ static int qemuStringToArgvEnv(const char *args, error: VIR_FREE(progenv); VIR_FREE(progargv); - virStringFreeList(arglist); + virStringListFree(arglist); return -1; } @@ -1588,7 +1588,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, case VIR_DOMAIN_HYPERV_LAST: break; } - virStringFreeList(hv_tokens); + virStringListFree(hv_tokens); hv_tokens = NULL; } else if (STREQ(tokens[i], "kvm=off")) { dom->features[VIR_DOMAIN_FEATURE_KVM] = VIR_TRISTATE_SWITCH_ON; @@ -1619,8 +1619,8 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, cleanup: VIR_FREE(model); - virStringFreeList(tokens); - virStringFreeList(hv_tokens); + virStringListFree(tokens); + virStringListFree(hv_tokens); return ret; syntax: @@ -2196,7 +2196,7 @@ qemuParseCommandLine(virCapsPtr caps, def->keywrap->dea = VIR_TRISTATE_SWITCH_ABSENT; } } - virStringFreeList(list); + virStringListFree(list); list = NULL; } else if (STREQ(arg, "-serial")) { WANT_VALUE(); @@ -2658,7 +2658,7 @@ qemuParseCommandLine(virCapsPtr caps, virDomainDiskDefFree(disk); qemuDomainCmdlineDefFree(cmd); virDomainDefFree(def); - virStringFreeList(list); + virStringListFree(list); VIR_FREE(nics); if (monConfig) { virDomainChrSourceDefFree(*monConfig); @@ -2688,8 +2688,8 @@ virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps, pidfile, monConfig, monJSON); cleanup: - virStringFreeList(progargv); - virStringFreeList(progenv); + virStringListFree(progargv); + virStringListFree(progenv); return def; } @@ -2736,7 +2736,7 @@ static int qemuParseProcFileStrings(int pid_value, cleanup: if (ret < 0) - virStringFreeList(str); + virStringListFree(str); VIR_FREE(data); VIR_FREE(path); return ret; @@ -2780,7 +2780,7 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, cleanup: VIR_FREE(exepath); - virStringFreeList(progargv); - virStringFreeList(progenv); + virStringListFree(progargv); + virStringListFree(progenv); return def; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f8f379a..ab0c2c8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3164,7 +3164,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver, qemuDevices = (const char **) priv->qemuDevices; if ((tmp = old)) { while (*tmp) { - if (!virStringArrayHasString(qemuDevices, *tmp) && + if (!virStringListHasString(qemuDevices, *tmp) && virDomainDefFindDevice(vm->def, *tmp, &dev, false) == 0 && qemuDomainRemoveDevice(driver, vm, &dev) < 0) { goto cleanup; @@ -3175,7 +3175,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver, ret = 0; cleanup: - virStringFreeList(old); + virStringListFree(old); return ret; } @@ -5085,7 +5085,7 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, ret = 0; cleanup: - virStringFreeListCount(models, nmodels); + virStringListFreeCount(models, nmodels); return ret; } @@ -6067,7 +6067,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, VIR_FREE(vm->def->seclabels[i]->imagelabel); } - virStringFreeList(priv->qemuDevices); + virStringListFree(priv->qemuDevices); priv->qemuDevices = NULL; qemuHostdevReAttachDomainDevices(driver, vm->def); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index db2bdd4..8880520 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -6221,7 +6221,7 @@ remoteConnectGetCPUModelNames(virConnectPtr conn, rv = ret.ret; cleanup: - virStringFreeList(retmodels); + virStringListFree(retmodels); xdr_free((xdrproc_t) xdr_remote_connect_get_cpu_model_names_ret, (char *) &ret); diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c index 001d16f..ad2d756 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -173,7 +173,7 @@ virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED, goto cleanup; } - virStringFreeList(cells); + virStringListFree(cells); cells = NULL; } @@ -181,8 +181,8 @@ virStorageBackendSheepdogRefreshAllVol(virConnectPtr conn ATTRIBUTE_UNUSED, cleanup: virCommandFree(cmd); - virStringFreeList(lines); - virStringFreeList(cells); + virStringListFree(lines); + virStringListFree(cells); VIR_FREE(output); return ret; } diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c index a3477e2..3a43be4 100644 --- a/src/storage/storage_backend_zfs.c +++ b/src/storage/storage_backend_zfs.c @@ -168,8 +168,8 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool, ret = 0; cleanup: - virStringFreeList(tokens); - virStringFreeList(name_tokens); + virStringListFree(tokens); + virStringListFree(name_tokens); if (is_new_vol) virStorageVolDefFree(volume); return ret; @@ -219,7 +219,7 @@ virStorageBackendZFSFindVols(virStoragePoolObjPtr pool, cleanup: virCommandFree(cmd); - virStringFreeList(lines); + virStringListFree(lines); VIR_FREE(volumes_list); return 0; @@ -264,7 +264,7 @@ virStorageBackendZFSRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, if (STREQ(lines[i], "")) continue; - virStringFreeList(tokens); + virStringListFree(tokens); if (!(tokens = virStringSplitCount(lines[i], "\t", 0, &count))) goto cleanup; @@ -294,8 +294,8 @@ virStorageBackendZFSRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, cleanup: virCommandFree(cmd); - virStringFreeList(lines); - virStringFreeList(tokens); + virStringListFree(lines); + virStringListFree(tokens); VIR_FREE(zpool_props); return 0; diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 9900596..df65807 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -3392,7 +3392,7 @@ virStorageAddISCSIPoolSourceHost(virDomainDiskDefPtr def, ret = 0; cleanup: - virStringFreeList(tokens); + virStringListFree(tokens); return ret; } diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 9232994..f151193 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -863,14 +863,14 @@ virCgroupGetValueForBlkDev(virCgroupPtr group, if (!(lines = virStringSplit(str, "\n", -1))) goto error; - if (VIR_STRDUP(*value, virStringGetFirstWithPrefix(lines, prefix)) < 0) + if (VIR_STRDUP(*value, virStringListGetFirstWithPrefix(lines, prefix)) < 0) goto error; ret = 0; error: VIR_FREE(str); VIR_FREE(prefix); - virStringFreeList(lines); + virStringListFree(lines); return ret; } @@ -1275,13 +1275,13 @@ virCgroupSetPartitionSuffix(const char *path, char **res) goto cleanup; } - if (!(*res = virStringJoin((const char **)tokens, "/"))) + if (!(*res = virStringListJoin((const char **)tokens, "/"))) goto cleanup; ret = 0; cleanup: - virStringFreeList(tokens); + virStringListFree(tokens); return ret; } diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 2a59bd1..e1bbc05 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -3026,7 +3026,7 @@ virCommandRunRegex(virCommandPtr cmd, ret = 0; cleanup: - virStringFreeList(lines); + virStringListFree(lines); VIR_FREE(outbuf); if (groups) { for (j = 0; j < totgroups; j++) diff --git a/src/util/virconf.c b/src/util/virconf.c index 3e49f41..a85a307 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -983,7 +983,7 @@ int virConfGetValueStringList(virConfPtr conf, if (!cval) return 0; - virStringFreeList(*values); + virStringListFree(*values); *values = NULL; switch (cval->type) { @@ -1003,7 +1003,7 @@ int virConfGetValueStringList(virConfPtr conf, for (len = 0, eval = cval->list; eval; len++, eval = eval->next) { if (VIR_STRDUP((*values)[len], eval->str) < 0) { - virStringFreeList(*values); + virStringListFree(*values); *values = NULL; return -1; } diff --git a/src/util/virfile.c b/src/util/virfile.c index f006abf..1fb89ce 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1877,7 +1877,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath, cleanup: if (ret < 0) - virStringFreeList(mounts); + virStringListFree(mounts); endmntent(procmnt); return ret; } @@ -1906,7 +1906,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath ATTRIBUTE_UNUSED, * the path @prefix, sorted from shortest to longest path. * * The @mountsret array will be NULL terminated and should - * be freed with virStringFreeList + * be freed with virStringListFree * * Returns 0 on success, -1 on error */ @@ -1930,7 +1930,7 @@ int virFileGetMountSubtree(const char *mtabpath, * ie opposite order to which they appear in @mtabpath * * The @mountsret array will be NULL terminated and should - * be freed with virStringFreeList + * be freed with virStringListFree * * Returns 0 on success, -1 on error */ diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index f26fd86..3f97618 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -878,7 +878,7 @@ virFirewallApplyRule(virFirewallPtr firewall, ret = 0; cleanup: - virStringFreeList(lines); + virStringListFree(lines); VIR_FREE(output); return ret; } diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c index 6b20c06..86f8b68 100644 --- a/src/util/virfirmware.c +++ b/src/util/virfirmware.c @@ -87,7 +87,7 @@ virFirmwareParse(const char *str, virFirmwarePtr firmware) ret = 0; cleanup: - virStringFreeList(token); + virStringListFree(token); return ret; } @@ -132,6 +132,6 @@ virFirmwareParseList(const char *list, ret = 0; cleanup: - virStringFreeList(token); + virStringListFree(token); return ret; } diff --git a/src/util/virlog.c b/src/util/virlog.c index 8f831fc..77bc6b3 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1530,7 +1530,7 @@ virLogParseOutput(const char *src) } cleanup: - virStringFreeList(tokens); + virStringListFree(tokens); return ret; } @@ -1607,7 +1607,7 @@ virLogParseFilter(const char *src) goto cleanup; cleanup: - virStringFreeList(tokens); + virStringListFree(tokens); return ret; } @@ -1667,7 +1667,7 @@ virLogParseOutputs(const char *src, virLogOutputPtr **outputs) *outputs = list; list = NULL; cleanup: - virStringFreeList(strings); + virStringListFree(strings); return ret; } @@ -1717,7 +1717,7 @@ virLogParseFilters(const char *src, virLogFilterPtr **filters) *filters = list; list = NULL; cleanup: - virStringFreeList(strings); + virStringListFree(strings); return ret; } diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c index e7e46b8..c735ca9 100644 --- a/src/util/virpolkit.c +++ b/src/util/virpolkit.c @@ -137,7 +137,7 @@ int virPolkitCheckAuth(const char *actionid, } cleanup: - virStringFreeListCount(retdetails, nretdetails); + virStringListFreeCount(retdetails, nretdetails); return ret; } diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 3cacc89..7db97bc 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1014,7 +1014,7 @@ int virProcessGetStartTime(pid_t pid, ret = 0; cleanup: - virStringFreeList(tokens); + virStringListFree(tokens); VIR_FREE(filename); VIR_FREE(buf); return ret; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f6a1b5d..1011bd0 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1476,7 +1476,7 @@ virStorageFileParseChainIndex(const char *diskTarget, *chainIndex = idx; cleanup: - virStringFreeList(strings); + virStringListFree(strings); return ret; } @@ -2350,7 +2350,7 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src, cleanup: virURIFree(uri); - virStringFreeList(scheme); + virStringListFree(scheme); return ret; } @@ -2385,8 +2385,8 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src, parts = virStringSplit(hostport, "\\:", 0); if (!parts) goto error; - src->hosts[src->nhosts-1].name = virStringJoin((const char **)parts, ":"); - virStringFreeList(parts); + src->hosts[src->nhosts-1].name = virStringListJoin((const char **)parts, ":"); + virStringListFree(parts); if (!src->hosts[src->nhosts-1].name) goto error; @@ -2576,7 +2576,7 @@ virStorageSourceParseNBDColonString(const char *nbdstr, ret = 0; cleanup: - virStringFreeList(backing); + virStringListFree(backing); return ret; } @@ -3272,7 +3272,7 @@ virStorageFileCanonicalizeInjectSymlink(const char *path, ret = 0; cleanup: - virStringFreeListCount(tmp, ntmp); + virStringListFreeCount(tmp, ntmp); return ret; } @@ -3420,7 +3420,7 @@ virStorageFileCanonicalizePath(const char *path, cleanup: virHashFree(cycle); - virStringFreeListCount(components, ncomponents); + virStringListFreeCount(components, ncomponents); VIR_FREE(linkpath); VIR_FREE(currentpath); @@ -3534,6 +3534,6 @@ virStorageFileCheckCompat(const char *compat) ret = 0; cleanup: - virStringFreeList(version); + virStringListFree(version); return ret; } diff --git a/src/util/virstring.c b/src/util/virstring.c index f93d6b1..479b19c 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -38,7 +38,7 @@ VIR_LOG_INIT("util.string"); /* - * The following virStringSplit & virStringJoin methods + * The following virStringSplit & virStringListJoin methods * are derived from g_strsplit / g_strjoin in glib2, * also available under the LGPLv2+ license terms */ @@ -66,7 +66,7 @@ VIR_LOG_INIT("util.string"); * before calling virStringSplit(). * * Return value: a newly-allocated NULL-terminated array of strings. Use - * virStringFreeList() to free it. + * virStringListFree() to free it. */ char ** virStringSplitCount(const char *string, @@ -137,7 +137,7 @@ virStringSplit(const char *string, /** - * virStringJoin: + * virStringListJoin: * @strings: a NULL-terminated array of strings to join * @delim: a string to insert between each of the strings * @@ -148,8 +148,8 @@ virStringSplit(const char *string, * Returns: a newly-allocated string containing all of the strings joined * together, with @delim between them */ -char *virStringJoin(const char **strings, - const char *delim) +char *virStringListJoin(const char **strings, + const char *delim) { char *ret; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -169,13 +169,13 @@ char *virStringJoin(const char **strings, /** - * virStringFreeList: + * virStringListFree: * @str_array: a NULL-terminated array of strings to free * * Frees a NULL-terminated array of strings, and the array itself. - * If called on a NULL value, virStringFreeList() simply returns. + * If called on a NULL value, virStringListFree() simply returns. */ -void virStringFreeList(char **strings) +void virStringListFree(char **strings) { char **tmp = strings; while (tmp && *tmp) { @@ -187,14 +187,14 @@ void virStringFreeList(char **strings) /** - * virStringFreeListCount: + * virStringListFreeCount: * @strings: array of strings to free * @count: number of elements in the array * * Frees a string array of @count length. */ void -virStringFreeListCount(char **strings, +virStringListFreeCount(char **strings, size_t count) { size_t i; @@ -210,8 +210,8 @@ virStringFreeListCount(char **strings, bool -virStringArrayHasString(const char **strings, - const char *needle) +virStringListHasString(const char **strings, + const char *needle) { size_t i = 0; @@ -227,7 +227,7 @@ virStringArrayHasString(const char **strings, } char * -virStringGetFirstWithPrefix(char **strings, const char *prefix) +virStringListGetFirstWithPrefix(char **strings, const char *prefix) { size_t i = 0; @@ -814,7 +814,7 @@ int virStringSortRevCompare(const void *a, const void *b) * @result: pointer to an array to be filled with NULL terminated list of matches * * Performs a POSIX extended regex search against a string and return all matching substrings. - * The @result value should be freed with virStringFreeList() when no longer + * The @result value should be freed with virStringListFree() when no longer * required. * * @code @@ -834,7 +834,7 @@ int virStringSortRevCompare(const void *a, const void *b) * // matches[2] == "bbb3c75c-d60f-43b0-b802-fd56b84a4222" * // matches[3] == NULL; * - * virStringFreeList(matches); + * virStringListFree(matches); * @endcode * * Returns: -1 on error, or number of matches @@ -902,7 +902,7 @@ virStringSearch(const char *str, cleanup: regfree(&re); if (ret < 0) { - virStringFreeList(*matches); + virStringListFree(*matches); *matches = NULL; } return ret; diff --git a/src/util/virstring.h b/src/util/virstring.h index 8854d5f..9826fc9 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -37,15 +37,15 @@ char **virStringSplit(const char *string, size_t max_tokens) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -char *virStringJoin(const char **strings, - const char *delim) +char *virStringListJoin(const char **strings, + const char *delim) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -void virStringFreeList(char **strings); -void virStringFreeListCount(char **strings, size_t count); +void virStringListFree(char **strings); +void virStringListFreeCount(char **strings, size_t count); -bool virStringArrayHasString(const char **strings, const char *needle); -char *virStringGetFirstWithPrefix(char **strings, const char *prefix) +bool virStringListHasString(const char **strings, const char *needle); +char *virStringListGetFirstWithPrefix(char **strings, const char *prefix) ATTRIBUTE_NONNULL(2); char *virArgvToString(const char *const *argv); diff --git a/src/util/viruri.c b/src/util/viruri.c index 2f252ac..b80d924 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -386,7 +386,7 @@ virURIResolveAlias(virConfPtr conf, const char *alias, char **uri) if (aliases && *aliases) { ret = virURIFindAliasMatch(aliases, alias, uri); - virStringFreeList(aliases); + virStringListFree(aliases); } else { ret = 0; } diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 7ae3dc7..af8a9f7 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -4933,7 +4933,7 @@ vboxSnapshotRedefine(virDomainPtr dom, tmp = virStringReplace(newSnapshotPtr->storageController, searchResultTab[it], uuidReplacing); - virStringFreeList(searchResultTab); + virStringListFree(searchResultTab); searchResultTab = NULL; VIR_FREE(newSnapshotPtr->storageController); if (!tmp) @@ -5341,9 +5341,9 @@ vboxSnapshotRedefine(virDomainPtr dom, VIR_FREE(currentSnapshotXmlFilePath); VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); - virStringFreeList(realReadOnlyDisksPath); - virStringFreeList(realReadWriteDisksPath); - virStringFreeList(searchResultTab); + virStringListFree(realReadOnlyDisksPath); + virStringListFree(realReadWriteDisksPath); + virStringListFree(searchResultTab); VIR_FREE(newSnapshotPtr); VIR_FREE(machineLocationPath); VIR_FREE(nameTmpUse); @@ -7187,7 +7187,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot) VBOX_RELEASE(machine); VBOX_UTF16_FREE(settingsFilePathUtf16); VBOX_UTF8_FREE(settingsFilepath); - virStringFreeList(searchResultTab); + virStringListFree(searchResultTab); VIR_FREE(snapshotMachineDesc); VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c index e1307e1..8bf7ef3 100644 --- a/src/vbox/vbox_snapshot_conf.c +++ b/src/vbox/vbox_snapshot_conf.c @@ -107,7 +107,7 @@ virVBoxSnapshotConfCreateVBoxSnapshotConfHardDiskPtr(xmlNodePtr diskNode, VIR_FREE(nodes); VIR_FREE(location); VIR_FREE(tmp); - virStringFreeList(searchTabResult); + virStringListFree(searchTabResult); if (result < 0) { virVboxSnapshotConfHardDiskFree(hardDisk); hardDisk = NULL; @@ -276,7 +276,7 @@ virVBoxSnapshotConfRetrieveSnapshot(xmlNodePtr snapshotNode, } VIR_FREE(nodes); VIR_FREE(uuid); - virStringFreeList(searchTabResult); + virStringListFree(searchTabResult); return snapshot; } @@ -458,8 +458,8 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, xmlUnlinkNode(snapshotsNode); xmlFreeNode(snapshotsNode); } - virStringFreeList(firstRegex); - virStringFreeList(secondRegex); + virStringListFree(firstRegex); + virStringListFree(secondRegex); VIR_FREE(uuid); VIR_FREE(timeStamp); return result; @@ -739,7 +739,7 @@ virVBoxSnapshotConfLoadVboxFile(const char *filePath, VIR_FREE(currentStateModifiedString); VIR_FREE(currentSnapshotAttribute); - virStringFreeList(searchResultTab); + virStringListFree(searchResultTab); if (ret < 0) { virVBoxSnapshotConfMachineFree(machineDescription); machineDescription = NULL; @@ -1235,8 +1235,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr machine, xmlFreeDoc(xml); - virStringFreeList(firstRegex); - virStringFreeList(secondRegex); + virStringListFree(firstRegex); + virStringListFree(secondRegex); return ret; } @@ -1324,7 +1324,7 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath, xmlFreeDoc(xml); xmlXPathFreeContext(xPathContext); if (result < 0) { - virStringFreeList(ret); + virStringListFree(ret); nodeSize = -1; } else { *rwDisksPath = ret; @@ -1385,7 +1385,7 @@ virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath, xmlFreeDoc(xml); xmlXPathFreeContext(xPathContext); if (result < 0) { - virStringFreeList(ret); + virStringListFree(ret); nodeSize = -1; } else { *roDisksPath = ret; diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index d61bccf..d7b754e 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -730,7 +730,7 @@ prlsdkGetFSInfo(PRL_HANDLE prldisk, cleanup: VIR_FREE(buf); - virStringFreeList(matches); + virStringListFree(matches); return ret; } diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c index 650c565..f5fec47 100644 --- a/tests/domainsnapshotxml2xmltest.c +++ b/tests/domainsnapshotxml2xmltest.c @@ -65,7 +65,7 @@ testFilterXML(char *xml) cleanup: virBufferFreeAndReset(&buf); - virStringFreeList(xmlLines); + virStringListFree(xmlLines); return ret; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index a7d4d5a..f729b2e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -591,7 +591,7 @@ testQemuMonitorJSONGetTPMModels(const void *data) cleanup: qemuMonitorTestFree(test); - virStringFreeList(tpmmodels); + virStringListFree(tpmmodels); return ret; } @@ -651,7 +651,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data) #undef CHECK - virStringFreeList(params); + virStringListFree(params); params = NULL; /* present but empty */ @@ -677,7 +677,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data) goto cleanup; } - virStringFreeList(params); + virStringListFree(params); params = NULL; /* no such option */ @@ -707,7 +707,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *data) cleanup: qemuMonitorTestFree(test); - virStringFreeList(params); + virStringListFree(params); return ret; } @@ -1151,20 +1151,20 @@ testQemuMonitorJSONGetDeviceAliases(const void *data) ret = 0; for (alias = (const char **) aliases; *alias; alias++) { - if (!virStringArrayHasString(expected, *alias)) { + if (!virStringListHasString(expected, *alias)) { fprintf(stderr, "got unexpected device alias '%s'\n", *alias); ret = -1; } } for (alias = expected; *alias; alias++) { - if (!virStringArrayHasString((const char **) aliases, *alias)) { + if (!virStringListHasString((const char **) aliases, *alias)) { fprintf(stderr, "missing expected alias '%s'\n", *alias); ret = -1; } } cleanup: - virStringFreeList(aliases); + virStringListFree(aliases); qemuMonitorTestFree(test); return ret; } diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1954696..e0ef47f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -160,7 +160,7 @@ fakeStorageVolLookupByName(virStoragePoolPtr pool, NULL, NULL); cleanup: - virStringFreeList(volinfo); + virStringListFree(volinfo); return ret; fallback: diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c index fa7bbfe..f84d199 100644 --- a/tests/vboxsnapshotxmltest.c +++ b/tests/vboxsnapshotxmltest.c @@ -47,7 +47,7 @@ testFilterXML(char *xml) cleanup: virBufferFreeAndReset(&buf); - virStringFreeList(xmlLines); + virStringListFree(xmlLines); return ret; } diff --git a/tests/virconftest.c b/tests/virconftest.c index dbf6ed6..4fc7993 100644 --- a/tests/virconftest.c +++ b/tests/virconftest.c @@ -394,7 +394,7 @@ static int testConfParseStringList(const void *opaque ATTRIBUTE_UNUSED) ret = 0; cleanup: - virStringFreeList(str); + virStringListFree(str); virConfFree(conf); return ret; } diff --git a/tests/virfiletest.c b/tests/virfiletest.c index a6458df..05148e9 100644 --- a/tests/virfiletest.c +++ b/tests/virfiletest.c @@ -84,7 +84,7 @@ static int testFileGetMountSubtree(const void *opaque) data->mounts, data->nmounts); cleanup: - virStringFreeList(gotmounts); + virStringListFree(gotmounts); return ret; } #endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */ diff --git a/tests/virpolkittest.c b/tests/virpolkittest.c index 421ffee..a51dd1c 100644 --- a/tests/virpolkittest.c +++ b/tests/virpolkittest.c @@ -124,7 +124,7 @@ VIR_MOCK_WRAP_RET_ARGS(dbus_connection_send_with_reply_and_block, VIR_FREE(uidkey); VIR_FREE(actionid); VIR_FREE(cancellationId); - virStringFreeListCount(details, detailslen); + virStringListFreeCount(details, detailslen); if (virDBusCreateReply(&reply, "(bba&{ss})", diff --git a/tests/virstringtest.c b/tests/virstringtest.c index f7e1e92..a11d7c5 100644 --- a/tests/virstringtest.c +++ b/tests/virstringtest.c @@ -94,7 +94,7 @@ static int testSplit(const void *args) ret = 0; cleanup: - virStringFreeList(got); + virStringListFree(got); return ret; } @@ -106,7 +106,7 @@ static int testJoin(const void *args) char *got; int ret = -1; - if (!(got = virStringJoin(data->tokens, data->delim))) { + if (!(got = virStringListJoin(data->tokens, data->delim))) { VIR_DEBUG("Got no result"); return -1; } @@ -354,7 +354,7 @@ testStringSearch(const void *opaque) ret = 0; cleanup: - virStringFreeList(matches); + virStringListFree(matches); return ret; } @@ -502,7 +502,7 @@ testStringToLong(const void *opaque) /* The point of this test is to check whether all members of the array are * freed. The test has to be checked using valgrind. */ static int -testVirStringFreeListCount(const void *opaque ATTRIBUTE_UNUSED) +testVirStringListFreeCount(const void *opaque ATTRIBUTE_UNUSED) { char **list; @@ -513,7 +513,7 @@ testVirStringFreeListCount(const void *opaque ATTRIBUTE_UNUSED) ignore_value(VIR_STRDUP(list[2], "test2")); ignore_value(VIR_STRDUP(list[3], "test3")); - virStringFreeListCount(list, 4); + virStringListFreeCount(list, 4); return 0; } @@ -779,8 +779,8 @@ mymain(void) TEST_STRTOL("-18446744073709551616", NULL, 0, -1, 0U, -1, 0LL, -1, 0ULL, -1); - /* test virStringFreeListCount */ - if (virTestRun("virStringFreeListCount", testVirStringFreeListCount, + /* test virStringListFreeCount */ + if (virTestRun("virStringListFreeCount", testVirStringListFreeCount, NULL) < 0) ret = -1; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 242f15e..e359bfc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -878,7 +878,7 @@ virshParseRateStr(vshControl *ctl, ret = 0; cleanup: - virStringFreeList(tok); + virStringListFree(tok); return ret; } @@ -4043,14 +4043,14 @@ cmdStartGetFDs(vshControl *ctl, fds[nfds - 1] = fd; } - virStringFreeList(fdlist); + virStringListFree(fdlist); *fdsret = fds; *nfdsret = nfds; return 0; error: - virStringFreeList(fdlist); + virStringListFree(fdlist); VIR_FREE(fds); return -1; } @@ -5570,7 +5570,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd) cleanup: if (dom) virDomainFree(dom); - virStringFreeList(modes); + virStringListFree(modes); return ret; } @@ -5650,7 +5650,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) cleanup: if (dom) virDomainFree(dom); - virStringFreeList(modes); + virStringListFree(modes); return ret; } @@ -8827,7 +8827,7 @@ virshParseEventStr(const char *event, ret = 0; cleanup: - virStringFreeList(tok); + virStringListFree(tok); return ret; } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 9446664..f76cade 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -156,7 +156,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - virStringFreeList(arr); + virStringListFree(arr); if (dev) virNodeDeviceFree(dev); return ret; @@ -498,7 +498,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) } cleanup: - virStringFreeList(caps); + virStringListFree(caps); virshNodeDeviceListFree(list); return ret; } @@ -567,7 +567,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - virStringFreeList(arr); + virStringListFree(arr); VIR_FREE(xml); if (device) virNodeDeviceFree(device); diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 7118a6c..8313be8 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1125,7 +1125,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) for (i = 0; i < npoolTypes; i++) { if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) < 0) { vshError(ctl, _("Invalid pool type '%s'"), poolTypes[i]); - virStringFreeList(poolTypes); + virStringListFree(poolTypes); return false; } @@ -1170,7 +1170,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) break; } } - virStringFreeList(poolTypes); + virStringListFree(poolTypes); } if (!(list = virshStoragePoolListCollect(ctl, flags))) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index e4d0df7..5c844a5 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -255,7 +255,7 @@ virshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str) cleanup: if (ret < 0) vshError(ctl, _("unable to parse memspec: %s"), str); - virStringFreeList(array); + virStringListFree(array); return ret; } @@ -306,7 +306,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str) cleanup: if (ret < 0) vshError(ctl, _("unable to parse diskspec: %s"), str); - virStringFreeList(array); + virStringListFree(array); return ret; } diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index 4bfc52a..6faed04 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -245,7 +245,7 @@ virBitmapPtr virHostValidateGetCPUFlags(void) ignore_value(virBitmapSetBit(flags, value)); } - virStringFreeListCount(tokens, ntokens); + virStringListFreeCount(tokens, ntokens); } while (1); cleanup: @@ -345,7 +345,7 @@ static int virHostValidateCGroupSupport(const char *hvname, matched = true; } - virStringFreeListCount(cgroups, ncgroups); + virStringListFreeCount(cgroups, ncgroups); } VIR_FREE(line); @@ -394,7 +394,7 @@ static int virHostValidateCGroupMount(const char *hvname, matched = true; } - virStringFreeListCount(opts, nopts); + virStringListFreeCount(opts, nopts); } endmntent(fp); if (!matched) diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index a2b32ac..016e2b6 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -90,7 +90,7 @@ static int virLoginShellAllowedUser(virConfPtr conf, name, conf_file); cleanup: VIR_FREE(gname); - virStringFreeList(users); + virStringListFree(users); return ret; } @@ -308,7 +308,7 @@ main(int argc, char **argv) if (autoshell) { tmp = virGetUserShell(uid); if (tmp) { - virStringFreeList(shargv); + virStringListFree(shargv); shargvlen = 1; if (VIR_ALLOC_N(shargv[0], shargvlen + 1) < 0) { VIR_FREE(tmp); @@ -394,7 +394,7 @@ main(int argc, char **argv) virDomainFree(dom); if (conn) virConnectClose(conn); - virStringFreeList(shargv); + virStringListFree(shargv); VIR_FREE(shcmd); VIR_FREE(term); VIR_FREE(name); diff --git a/tools/vsh.c b/tools/vsh.c index f94eaa3..c1fc041 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -179,7 +179,7 @@ vshNameSorter(const void *a, const void *b) /* * Convert the strings separated by ',' into array. The returned * array is a NULL terminated string list. The caller has to free - * the array using virStringFreeList or a similar method. + * the array using virStringListFree or a similar method. * * Returns the length of the filled array on success, or -1 * on error. @@ -2835,7 +2835,7 @@ vshReadlineParse(const char *text, int state) return res; } res = NULL; - virStringFreeList(completed_list); + virStringListFree(completed_list); completed_list_index = 0; } } -- 2.8.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list