]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Use virBufferTrimLen when applicable
authorJán Tomko <jtomko@redhat.com>
Sun, 2 Feb 2020 19:17:20 +0000 (20:17 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 3 Feb 2020 18:44:38 +0000 (19:44 +0100)
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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/lxc/lxc_container.c
tests/virbuftest.c
tools/vsh.c

index b44cc68e676e7268677bdaece21aef936fa9c10a..fcd964cd1eb064229d7e7bbf5a082e707e595a26 100644 (file)
@@ -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);
 
index 79190750007e25ae21c07721401c2657934c59c7..f2d4d9b9dea62052a44395ba74ac051ae604aabb 100644 (file)
@@ -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);
index 9c58e40d4fe73d7148b4b5a894b729a79fd27a21..3c3b4bf1c33277729f6a336810764caa322d76dd 100644 (file)
@@ -2525,7 +2525,7 @@ vshTreePrintInternal(vshControl *ctl,
         vshPrint(ctl, "%s\n", virBufferCurrentContent(indent));
 
     if (!root)
-        virBufferTrim(indent, NULL, 2);
+        virBufferTrimLen(indent, 2);
 
     return 0;
 }