summaryrefslogtreecommitdiff
path: root/tools/vsh-table.c
Commit message (Collapse)AuthorAgeFilesLines
* tools: Remove unused includesPeng Liang2022-06-161-1/+0
| | | | | Signed-off-by: Peng Liang <tcx4c70@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* vsh-table: Hide vshTableRow typedefMichal Privoznik2021-12-171-0/+1
| | | | | | | There's no need for any caller to know vshTableRow typedef. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* util: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElementPeter Krempa2021-08-061-6/+3
| | | | | | | | | | Use virAppendElement instead of virInsertElementsN to implement VIR_APPEND_ELEMENT which allows us to remove error handling as the only relevant errors were removed when switching to aborting memory allocation functions. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* lib: Drop internal virXXXPtr typedefsMichal Privoznik2021-04-131-18/+18
| | | | | | | | | | | | | | | | | | | | | | Historically, we declared pointer type to our types: typedef struct _virXXX virXXX; typedef virXXX *virXXXPtr; But usefulness of such declaration is questionable, at best. Unfortunately, we can't drop every such declaration - we have to carry some over, because they are part of public API (e.g. virDomainPtr). But for internal types - we can do drop them and use what every other C project uses 'virXXX *'. This change was generated by a very ugly shell script that generated sed script which was then called over each file in the repository. For the shell script refer to the cover letter: https://listman.redhat.com/archives/libvir-list/2021-March/msg00537.html Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
* vsh-table: Use g_autofree where possibleKristina Hanicova2021-03-041-9/+4
| | | | | | | | In: vshTableRowNew(), vshTablePrint(), vshTablePrintToStdout(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* tools: replace VIR_FREE with g_free in all vir*Free() functionsLaine Stump2021-02-051-5/+5
| | | | | Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* tools: use g_new0 instead of VIR_ALLOC*Ján Tomko2020-10-011-14/+7
| | | | | | | With the exception of vsh*alloc. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
* tools: remove unnecessary includesJán Tomko2020-08-031-2/+0
| | | | | | | | After the split of virsh to multiple files, and the subsequent split to vsh/virt-admin, there are quite a few leftovers. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
* tools: use g_auto() for all virBuffersLaine Stump2020-07-081-1/+1
| | | | | Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
* tools: replace wcwidth() with g_unichar_* APIsDaniel P. Berrangé2020-01-291-1/+1
| | | | | | | | | The combination of g_unichar_iszerowidth and g_unichar_iswide is sufficient to replicate the logic of wcwidth() for libvirt. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* use g_ascii_isprint instead of c_isprint from gnulibPavel Hrdina2019-12-101-2/+1
| | | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
* use g_ascii_iscntrl instead of c_iscntrl from gnulibPavel Hrdina2019-12-101-1/+1
| | | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
* replace use of gnulib snprintf by g_snprintfPavel Hrdina2019-11-151-3/+3
| | | | | | | | Glib implementation follows the ISO C99 standard so it's safe to replace the gnulib implementation. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
* tools: use g_strdup instead of VIR_STRDUPJán Tomko2019-10-211-2/+1
| | | | | | | | | | | Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a = g_strdup(b); Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* vsh-table: allow empty columnsJán Tomko2019-02-121-3/+0
| | | | | | | | | | Trivially implement this by deleting the bogus check in vshTableSafeEncode. Now it returns an empty string for an empty string instead of returning NULL without setting an error. Signed-off-by: Ján Tomko <jtomko@redhat.com>
* Remove all Author(s): lines from source file headersDaniel P. Berrangé2018-12-131-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many files there are header comments that contain an Author: statement, supposedly reflecting who originally wrote the code. In a large collaborative project like libvirt, any non-trivial file will have been modified by a large number of different contributors. IOW, the Author: comments are quickly out of date, omitting people who have made significant contribitions. In some places Author: lines have been added despite the person merely being responsible for creating the file by moving existing code out of another file. IOW, the Author: lines give an incorrect record of authorship. With this all in mind, the comments are useless as a means to identify who to talk to about code in a particular file. Contributors will always be better off using 'git log' and 'git blame' if they need to find the author of a particular bit of code. This commit thus deletes all Author: comments from the source and adds a rule to prevent them reappearing. The Copyright headers are similarly misleading and inaccurate, however, we cannot delete these as they have legal meaning, despite being largely inaccurate. In addition only the copyright holder is permitted to change their respective copyright statement. Reviewed-by: Erik Skultety <eskultet@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Fix minor typos in messages and docsYuri Chornoivan2018-12-051-1/+1
| | | | | | Signed-off-by: Yuri Chornoivan <yurchor@ukr.net> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* vsh-table: Get rid of trailing spacesSimon Kobyda2018-11-281-2/+4
| | | | | | Get rid of trailing spaces which can be found after last column in tables. Signed-off-by: Simon Kobyda <skobyda@redhat.com>
* src: More cleanup of some system headers already contained in internal.hErik Skultety2018-09-201-1/+0
| | | | | | | | | | | All of the ones being removed are pulled in by internal.h. The only exception is sanlock which expects the application to include <stdint.h> before sanlock's headers, because sanlock prototypes use fixed width int, but they don't include stdint.h themselves, so we have to leave that one in place. Signed-off-by: Erik Skultety <eskultet@redhat.com> Acked-by: Michal Privoznik <mprivozn@redhat.com>
* vsh: Add API for printing tables.Simon Kobyda2018-08-241-0/+460
It solves problems with alignment of columns. Width of each column is calculated by its biggest cell. Should solve unicode bug. In future, it may be implemented in virsh, virt-admin... This API has 5 public functions: - vshTableNew - adds new table and defines its header - vshTableRowAppend - appends new row (for same number of columns as in header) - vshTablePrintToStdout - vshTablePrintToString - vshTableFree https://bugzilla.redhat.com/show_bug.cgi?id=1574624 https://bugzilla.redhat.com/show_bug.cgi?id=1584630 Signed-off-by: Simon Kobyda <skobyda@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>