提交 bd734bbb 编写于 作者: P Peter Krempa

util: string: Use VIR_AUTOSTRINGLIST instead of VIR_AUTOPTR(virString)

Use of VIR_AUTOPTR and virString is confusing as it's a list and not a
single pointer. Replace it by VIR_AUTOSTRINGLIST as string lists are
basically the only sane NULL-terminated list we can have.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
上级 daefda16
......@@ -1181,7 +1181,7 @@ int virLXCProcessStart(virConnectPtr conn,
size_t i;
char *logfile = NULL;
int logfd = -1;
VIR_AUTOPTR(virString) veths = NULL;
VIR_AUTOSTRINGLIST veths = NULL;
int handshakefds[2] = { -1, -1 };
off_t pos = -1;
char ebuf[1024];
......
......@@ -645,7 +645,7 @@ static int
virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
virConfPtr conf)
{
VIR_AUTOPTR(virString) hugetlbfs = NULL;
VIR_AUTOSTRINGLIST hugetlbfs = NULL;
VIR_AUTOFREE(char *) stdioHandler = NULL;
VIR_AUTOFREE(char *) corestr = NULL;
size_t i;
......@@ -832,7 +832,7 @@ static int
virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg,
virConfPtr conf)
{
VIR_AUTOPTR(virString) nvram = NULL;
VIR_AUTOSTRINGLIST nvram = NULL;
size_t i;
if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0)
......@@ -869,8 +869,8 @@ virQEMUDriverConfigLoadSecurityEntry(virQEMUDriverConfigPtr cfg,
virConfPtr conf,
bool privileged)
{
VIR_AUTOPTR(virString) controllers = NULL;
VIR_AUTOPTR(virString) namespaces = NULL;
VIR_AUTOSTRINGLIST controllers = NULL;
VIR_AUTOSTRINGLIST namespaces = NULL;
VIR_AUTOFREE(char *) user = NULL;
VIR_AUTOFREE(char *) group = NULL;
size_t i, j;
......
......@@ -138,8 +138,8 @@ virStorageBackendSheepdogRefreshAllVol(virStoragePoolObjPtr pool)
{
size_t i;
VIR_AUTOFREE(char *) output = NULL;
VIR_AUTOPTR(virString) lines = NULL;
VIR_AUTOPTR(virString) cells = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_AUTOSTRINGLIST cells = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
cmd = virCommandNewArgList(SHEEPDOGCLI, "vdi", "list", "-r", NULL);
......
......@@ -106,8 +106,8 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
bool is_new_vol = false;
virStorageVolDefPtr volume = NULL;
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
VIR_AUTOPTR(virString) tokens = NULL;
VIR_AUTOPTR(virString) name_tokens = NULL;
VIR_AUTOSTRINGLIST tokens = NULL;
VIR_AUTOSTRINGLIST name_tokens = NULL;
if (!(tokens = virStringSplitCount(volume_string, "\t", 0, &count)))
return -1;
......@@ -177,7 +177,7 @@ virStorageBackendZFSFindVols(virStoragePoolObjPtr pool,
{
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
size_t i;
VIR_AUTOPTR(virString) lines = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_AUTOPTR(virCommand) cmd = NULL;
VIR_AUTOFREE(char *) volumes_list = NULL;
......@@ -224,8 +224,8 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED)
char *zpool_props = NULL;
size_t i;
VIR_AUTOPTR(virCommand) cmd = NULL;
VIR_AUTOPTR(virString) lines = NULL;
VIR_AUTOPTR(virString) tokens = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_AUTOSTRINGLIST tokens = NULL;
/**
* $ zpool get -Hp health,size,free,allocated test
......
......@@ -2983,7 +2983,7 @@ virCommandRunRegex(virCommandPtr cmd,
int totgroups = 0, ngroup = 0, maxvars = 0;
char **groups;
VIR_AUTOFREE(char *) outbuf = NULL;
VIR_AUTOPTR(virString) lines = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
int ret = -1;
/* Compile all regular expressions */
......
......@@ -719,7 +719,7 @@ virFirewallApplyRule(virFirewallPtr firewall,
{
VIR_AUTOFREE(char *) output = NULL;
VIR_AUTOFREE(char *) str = virFirewallRuleToString(rule);
VIR_AUTOPTR(virString) lines = NULL;
VIR_AUTOSTRINGLIST lines = NULL;
VIR_INFO("Applying rule '%s'", NULLSTR(str));
if (rule->ignoreErrors)
......
......@@ -987,7 +987,7 @@ int virProcessGetStartTime(pid_t pid,
int len;
VIR_AUTOFREE(char *) filename = NULL;
VIR_AUTOFREE(char *) buf = NULL;
VIR_AUTOPTR(virString) tokens = NULL;
VIR_AUTOSTRINGLIST tokens = NULL;
if (virAsprintf(&filename, "/proc/%llu/stat", (long long) pid) < 0)
return -1;
......
......@@ -1568,7 +1568,7 @@ virStorageFileParseBackingStoreStr(const char *str,
size_t nstrings;
unsigned int idx = 0;
char *suffix;
VIR_AUTOPTR(virString) strings = NULL;
VIR_AUTOSTRINGLIST strings = NULL;
*chainIndex = 0;
......@@ -2652,7 +2652,7 @@ virStorageSourceParseBackingURI(virStorageSourcePtr src,
virURIPtr uri = NULL;
const char *path = NULL;
int ret = -1;
VIR_AUTOPTR(virString) scheme = NULL;
VIR_AUTOSTRINGLIST scheme = NULL;
if (!(uri = virURIParse(uristr))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -2756,7 +2756,7 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src,
{
char *port;
size_t skip;
VIR_AUTOPTR(virString) parts = NULL;
VIR_AUTOSTRINGLIST parts = NULL;
if (VIR_EXPAND_N(src->hosts, src->nhosts, 1) < 0)
return -1;
......@@ -2912,7 +2912,7 @@ static int
virStorageSourceParseNBDColonString(const char *nbdstr,
virStorageSourcePtr src)
{
VIR_AUTOPTR(virString) backing = NULL;
VIR_AUTOSTRINGLIST backing = NULL;
if (!(backing = virStringSplit(nbdstr, ":", 0)))
return -1;
......@@ -4190,7 +4190,7 @@ int
virStorageFileCheckCompat(const char *compat)
{
unsigned int result;
VIR_AUTOPTR(virString) version = NULL;
VIR_AUTOSTRINGLIST version = NULL;
if (!compat)
return 0;
......
......@@ -473,7 +473,7 @@ xenHandleConfGetValueStringListErrors(int ret)
static int
xenParsePCIList(virConfPtr conf, virDomainDefPtr def)
{
VIR_AUTOPTR(virString) pcis = NULL;
VIR_AUTOSTRINGLIST pcis = NULL;
virString *entries = NULL;
int rc;
......@@ -666,7 +666,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
}
if (!hvm && def->graphics == NULL) { /* New PV guests use this format */
VIR_AUTOPTR(virString) vfbs = NULL;
VIR_AUTOSTRINGLIST vfbs = NULL;
int rc;
if ((rc = virConfGetValueStringList(conf, "vfb", false, &vfbs)) == 1) {
......@@ -764,7 +764,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
static int
xenParseCharDev(virConfPtr conf, virDomainDefPtr def, const char *nativeFormat)
{
VIR_AUTOPTR(virString) serials = NULL;
VIR_AUTOSTRINGLIST serials = NULL;
virDomainChrDefPtr chr = NULL;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册