]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Rename [n]macs and maxmacs to [n]names and maxnames
authorJohn Ferlan <jferlan@redhat.com>
Fri, 20 Oct 2017 18:48:23 +0000 (14:48 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 20 Oct 2017 18:48:23 +0000 (14:48 -0400)
To avoid further confusion - rename the array elements to what they are.

src/conf/virinterfaceobj.c

index 21d76e750790b5de069a831a209b7cc948f5b01b..f90c0bd9c455964162a29d93a06ec4a8e30df4ae 100644 (file)
@@ -160,9 +160,9 @@ virInterfaceObjListNew(void)
 struct _virInterfaceObjFindMACData {
     const char *matchStr;
     bool error;
-    int nmacs;
-    int maxmacs;
-    char **const macs;
+    int nnames;
+    int maxnames;
+    char **const names;
 };
 
 static int
@@ -176,17 +176,17 @@ virInterfaceObjListFindByMACStringCb(void *payload,
     if (data->error)
         return 0;
 
-    if (data->nmacs == data->maxmacs)
+    if (data->nnames == data->maxnames)
         return 0;
 
     virObjectLock(obj);
 
     if (STRCASEEQ(obj->def->mac, data->matchStr)) {
-        if (VIR_STRDUP(data->macs[data->nmacs], obj->def->name) < 0) {
+        if (VIR_STRDUP(data->names[data->nnames], obj->def->name) < 0) {
             data->error = true;
             goto cleanup;
         }
-        data->nmacs++;
+        data->nnames++;
     }
 
  cleanup:
@@ -203,9 +203,9 @@ virInterfaceObjListFindByMACString(virInterfaceObjListPtr interfaces,
 {
     struct _virInterfaceObjFindMACData data = { .matchStr = mac,
                                                 .error = false,
-                                                .nmacs = 0,
-                                                .maxmacs = maxmatches,
-                                                .macs = matches };
+                                                .nnames = 0,
+                                                .maxnames = maxmatches,
+                                                .names = matches };
 
     virObjectRWLockRead(interfaces);
     virHashForEach(interfaces->objsName, virInterfaceObjListFindByMACStringCb,
@@ -215,11 +215,11 @@ virInterfaceObjListFindByMACString(virInterfaceObjListPtr interfaces,
     if (data.error)
         goto error;
 
-    return data.nmacs;
+    return data.nnames;
 
  error:
-    while (--data.nmacs >= 0)
-        VIR_FREE(data.macs[data.nmacs]);
+    while (--data.nnames >= 0)
+        VIR_FREE(data.names[data.nnames]);
 
     return -1;
 }