[libvirt PATCH 2/3] Use virBufferTrimLen when applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace all the cases that only supply the length
and do not care about matching a suffix, as well
as that one test case that does.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/lxc/lxc_container.c | 2 +-
 tests/virbuftest.c      | 6 +++---
 tools/vsh.c             | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index b44cc68e67..fcd964cd1e 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -215,7 +215,7 @@ static virCommandPtr lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
         virBufferAdd(&buf, ttyPaths[i] + 5, -1);
         virBufferAddChar(&buf, ' ');
     }
-    virBufferTrim(&buf, NULL, 1);
+    virBufferTrimLen(&buf, 1);
 
     virUUIDFormat(vmDef->uuid, uuidstr);
 
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index 7919075000..f2d4d9b9de 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -108,9 +108,9 @@ static int testBufTrim(const void *data G_GNUC_UNUSED)
     virBufferAddLit(buf, "a;");
     virBufferTrim(buf, "", 0);
     virBufferTrim(buf, "", -1);
-    virBufferTrim(buf, NULL, 1);
-    virBufferTrim(buf, NULL, 5);
-    virBufferTrim(buf, "a", 2);
+    virBufferTrimLen(buf, 1);
+    virBufferTrimLen(buf, 5);
+    virBufferTrimLen(buf, 2);
 
     virBufferAddLit(buf, ",b,,");
     virBufferTrim(buf, NULL, -1);
diff --git a/tools/vsh.c b/tools/vsh.c
index 9c58e40d4f..3c3b4bf1c3 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2525,7 +2525,7 @@ vshTreePrintInternal(vshControl *ctl,
         vshPrint(ctl, "%s\n", virBufferCurrentContent(indent));
 
     if (!root)
-        virBufferTrim(indent, NULL, 2);
+        virBufferTrimLen(indent, 2);
 
     return 0;
 }
-- 
2.19.2





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux