[libvirt] [PATCH 1/2] vsh-table: Get rid of trailing spaces

Simon Kobyda skobyda at redhat.com
Tue Nov 27 09:07:32 UTC 2018


Get rid of trailing spaces which can be found after last column in tables.

Signed-off-by: Simon Kobyda <skobyda at redhat.com>
---
 tools/vsh-table.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/vsh-table.c b/tools/vsh-table.c
index 9b4a34c1e6..fb656ffeb0 100644
--- a/tools/vsh-table.c
+++ b/tools/vsh-table.c
@@ -348,8 +348,10 @@ vshTableRowPrint(vshTableRowPtr row,
     for (i = 0; i < row->ncells; i++) {
         virBufferAsprintf(buf, " %s", row->cells[i]);
 
-        for (j = 0; j < maxwidths[i] - widths[i] + 2; j++)
-            virBufferAddChar(buf, ' ');
+        if (i < (row->ncells - 1)) {
+            for (j = 0; j < maxwidths[i] - widths[i] + 2; j++)
+                virBufferAddChar(buf, ' ');
+        }
     }
     virBufferAddChar(buf, '\n');
 }
-- 
2.17.1




More information about the libvir-list mailing list