]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: string: Use VIR_AUTOSTRINGLIST instead of VIR_AUTOPTR(virString)
authorPeter Krempa <pkrempa@redhat.com>
Fri, 22 Feb 2019 14:01:02 +0000 (15:01 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 4 Mar 2019 12:04:20 +0000 (13:04 +0100)
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: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/lxc/lxc_process.c
src/qemu/qemu_conf.c
src/storage/storage_backend_sheepdog.c
src/storage/storage_backend_zfs.c
src/util/vircommand.c
src/util/virfirewall.c
src/util/virprocess.c
src/util/virstoragefile.c
src/xenconfig/xen_common.c

index a3481bfa08b7bcbfd9d6495ec790a8a3693eb9bf..e0729a24bf076a035c224e67be0aa9bbe02c7c06 100644 (file)
@@ -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];
index 2f5ef8d0c4ca63d22a620079ff3802fed3b96121..42122dcd97da11d914da941189fbce453e8b5dd1 100644 (file)
@@ -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;
index 99f3283a1c89635cfb5311f6c3c0f799766ee541..6df90937c2d2194ba74fbd797ec75997b0afe885 100644 (file)
@@ -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);
index 7ffdff638ed4f855520f33466c24ed18531cf879..826a95538e9bfd53bdf55e3bc39beb35b509bad0 100644 (file)
@@ -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
index 3d533c68a6cdeabafaa86bb168190d81cf34d018..84a65a2f6d330401311960e39f341ab455c16e57 100644 (file)
@@ -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 */
index d63ce05ed879b83c34358338227367ab578fb16b..d42c734ea6f3087f6153c7180e0c2b3ac9c28a37 100644 (file)
@@ -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)
index 4e69228f346168eef25999d5c247283b0a4c4c15..52b86c549d494bacec2d4e56637e928f6267a57b 100644 (file)
@@ -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;
index 003183bf76c4abeaad187b28d1d2e53147ff7a00..233278e879f92e6138d5c4dab91367640a32868c 100644 (file)
@@ -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;
index 94e0703cf3137a94d06a043be4d2d9f226580822..2c8179f19c9a7ffc6f0e75ce501cbd7ee3c02c65 100644 (file)
@@ -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) {