]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: add scols_table_is_empty()
authorOndrej Oprala <ooprala@redhat.com>
Thu, 27 Mar 2014 13:04:58 +0000 (14:04 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Apr 2014 10:29:18 +0000 (12:29 +0200)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
libsmartcols/docs/libsmartcols-sections.txt
libsmartcols/src/libsmartcols.h.in
libsmartcols/src/libsmartcols.sym
libsmartcols/src/table.c

index c60d16b64136173456184513c731a3bf18a006f2..85a9feb1498c11d93991b33aa0f15aa9634b2f04 100644 (file)
@@ -92,6 +92,7 @@ scols_table_get_ncols
 scols_table_get_nlines
 scols_table_get_stream
 scols_table_is_ascii
+scols_table_is_empty
 scols_table_is_export
 scols_table_is_max
 scols_table_is_no_headings
index e40aad4cde08fa7f4d2482a9c8464dff59d63861..c8b0966a315be3ffce1b4b8e4503b46697a79d94 100644 (file)
@@ -149,6 +149,7 @@ extern int scols_table_colors_wanted(struct libscols_table *tb);
 extern int scols_table_is_raw(struct libscols_table *tb);
 extern int scols_table_is_ascii(struct libscols_table *tb);
 extern int scols_table_is_no_headings(struct libscols_table *tb);
+extern int scols_table_is_empty(struct libscols_table *tb);
 extern int scols_table_is_export(struct libscols_table *tb);
 extern int scols_table_is_max(struct libscols_table *tb);
 extern int scols_table_is_tree(struct libscols_table *tb);
index 90ecd771c4713fc6377c92be4a93dcb90ecd73bf..19c260198e10423c6d527dca683a1f34144898be 100644 (file)
@@ -68,6 +68,7 @@ global:
        scols_table_get_nlines;
        scols_table_get_stream;
        scols_table_is_ascii;
+       scols_table_is_empty;
        scols_table_is_export;
        scols_table_is_max;
        scols_table_is_no_headings;
index d26eee8e61ea76b2673defbb57a1a2fe6b4e82a8..d05c1435f7b596fb2d3d147f7b2b89e8859a0d34 100644 (file)
@@ -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