All callers use nameLen == -1 anyway.

Signed-off-by: Jiri Denemark <jdene...@redhat.com>
Reviewed-by: Ján Tomko <jto...@redhat.com>
---

Notes:
    Version 2:
    - no change

 src/conf/domain_capabilities.c | 7 +++----
 src/conf/domain_capabilities.h | 1 -
 src/qemu/qemu_capabilities.c   | 2 +-
 tests/cputest.c                | 4 ++--
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 3224ec3f52..ab8ebb650d 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -171,7 +171,7 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old)
 
     for (i = 0; i < old->nmodels; i++) {
         if (virDomainCapsCPUModelsAdd(cpuModels,
-                                      old->models[i].name, -1,
+                                      old->models[i].name,
                                       old->models[i].usable,
                                       old->models[i].blockers) < 0)
             goto error;
@@ -204,7 +204,7 @@ virDomainCapsCPUModelsFilter(virDomainCapsCPUModelsPtr old,
             continue;
 
         if (virDomainCapsCPUModelsAdd(cpuModels,
-                                      old->models[i].name, -1,
+                                      old->models[i].name,
                                       old->models[i].usable,
                                       old->models[i].blockers) < 0)
             goto error;
@@ -242,14 +242,13 @@ virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr 
cpuModels,
 int
 virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
                           const char *name,
-                          ssize_t nameLen,
                           virDomainCapsCPUUsable usable,
                           char **blockers)
 {
     VIR_AUTOFREE(char *) nameCopy = NULL;
     VIR_AUTOSTRINGLIST blockersCopy = NULL;
 
-    if (VIR_STRNDUP(nameCopy, name, nameLen) < 0)
+    if (VIR_STRDUP(nameCopy, name) < 0)
         return -1;
 
     if (virStringListCopy(&blockersCopy, (const char **)blockers) < 0)
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 3a92194602..e3bd8d423e 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -204,7 +204,6 @@ int 
virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
                                    char ***blockers);
 int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
                               const char *name,
-                              ssize_t nameLen,
                               virDomainCapsCPUUsable usable,
                               char **blockers);
 virDomainCapsCPUModelPtr
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index efd71d69c5..14939fc91d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1879,7 +1879,7 @@ virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCaps,
     }
 
     for (i = 0; i < count; i++) {
-        if (virDomainCapsCPUModelsAdd(cpus, name[i], -1, usable, NULL) < 0)
+        if (virDomainCapsCPUModelsAdd(cpus, name[i], usable, NULL) < 0)
             return -1;
     }
 
diff --git a/tests/cputest.c b/tests/cputest.c
index e3937c6fd6..7f47e3b601 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -863,7 +863,7 @@ cpuTestUpdateLive(const void *arg)
             usable = hvModel->usable;
         }
 
-        if (virDomainCapsCPUModelsAdd(models, expected->model, -1,
+        if (virDomainCapsCPUModelsAdd(models, expected->model,
                                       usable, blockers) < 0)
             goto cleanup;
 
@@ -973,7 +973,7 @@ cpuTestInitModels(const char **list)
         return NULL;
 
     for (model = list; *model; model++) {
-        if (virDomainCapsCPUModelsAdd(cpus, *model, -1,
+        if (virDomainCapsCPUModelsAdd(cpus, *model,
                                       VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL) < 
0)
             goto error;
     }
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to