summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/line.c
diff options
context:
space:
mode:
authorKarel Zak2016-09-19 13:39:03 +0200
committerKarel Zak2016-09-19 13:39:03 +0200
commitd4275a4bde84c9c295859131cd661f165362f9e3 (patch)
tree77113ed543013a846070e44a74212543dc767ac5 /libsmartcols/src/line.c
parenttests: add columns separator to libsmartcols test (diff)
downloadkernel-qcow2-util-linux-d4275a4bde84c9c295859131cd661f165362f9e3.tar.gz
kernel-qcow2-util-linux-d4275a4bde84c9c295859131cd661f165362f9e3.tar.xz
kernel-qcow2-util-linux-d4275a4bde84c9c295859131cd661f165362f9e3.zip
libsmartcols: cleanup get functions
The patch introduces tiny API changes (int -> size_t) for scols_table_get_ncols scols_table_get_nlines Addresses: https://github.com/karelzak/util-linux/issues/349 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/line.c')
-rw-r--r--libsmartcols/src/line.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libsmartcols/src/line.c b/libsmartcols/src/line.c
index a0e3a856c..365f6648a 100644
--- a/libsmartcols/src/line.c
+++ b/libsmartcols/src/line.c
@@ -168,12 +168,11 @@ int scols_line_set_userdata(struct libscols_line *ln, void *data)
* scols_line_get_userdata:
* @ln: a pointer to a struct libscols_line instance
*
- * Returns: 0, a negative value in case of an error.
+ * Returns: user data
*/
void *scols_line_get_userdata(struct libscols_line *ln)
{
- assert(ln);
- return ln ? ln->userdata : NULL;
+ return ln->userdata;
}
/**
@@ -307,18 +306,18 @@ int scols_line_set_color(struct libscols_line *ln, const char *co)
*/
const char *scols_line_get_color(struct libscols_line *ln)
{
- return ln ? ln->color : NULL;
+ return ln->color;
}
/**
* scols_line_get_ncells:
* @ln: a pointer to a struct libscols_line instance
*
- * Returns: @ln's number of cells
+ * Returns: @ln's number of cells or a negative value in case of an error.
*/
size_t scols_line_get_ncells(struct libscols_line *ln)
{
- return ln ? ln->ncells : 0;
+ return ln->ncells;
}
/**