summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
authorOndrej Oprala2014-03-27 14:04:58 +0100
committerKarel Zak2014-04-03 12:29:18 +0200
commitc0070f8187dd09671317b1462d99311ac582bc90 (patch)
tree107eb78dcfcd79c5f251855383b617d7354cca2e /libsmartcols/src/table.c
parentlibsmartcols: fix a usage example (diff)
downloadkernel-qcow2-util-linux-c0070f8187dd09671317b1462d99311ac582bc90.tar.gz
kernel-qcow2-util-linux-c0070f8187dd09671317b1462d99311ac582bc90.tar.xz
kernel-qcow2-util-linux-c0070f8187dd09671317b1462d99311ac582bc90.zip
libsmartcols: add scols_table_is_empty()
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index d26eee8e6..d05c1435f 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -793,6 +793,17 @@ int scols_table_colors_wanted(struct libscols_table *tb)
return -EINVAL;
return tb->colors_wanted;
}
+
+/**
+ * scols_table_is_empty:
+ * @tb: table
+ *
+ * Returns: 1 if empty, 0 if not (or in case of an error).
+ */
+int scols_table_is_empty(struct libscols_table *tb)
+{
+ return !tb || !tb->nlines;
+}
/**
* scols_table_is_raw:
* @tb: table