summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
authorKarel Zak2016-09-23 11:14:15 +0200
committerKarel Zak2016-09-23 11:14:15 +0200
commit266eecd54e6b99e851272b63d7ad12a6817e3797 (patch)
treedae47952d69cbf1df2d9366e5e74d3195c0b4c6a /libsmartcols/src/table.c
parentMerge branch 'master' of https://github.com/ignatenkobrain/util-linux (diff)
parentlibsmartcols: use const qualifier where it's possible (diff)
downloadkernel-qcow2-util-linux-266eecd54e6b99e851272b63d7ad12a6817e3797.tar.gz
kernel-qcow2-util-linux-266eecd54e6b99e851272b63d7ad12a6817e3797.tar.xz
kernel-qcow2-util-linux-266eecd54e6b99e851272b63d7ad12a6817e3797.zip
Merge branch 'api_const' of https://github.com/ignatenkobrain/util-linux
* 'api_const' of https://github.com/ignatenkobrain/util-linux: libsmartcols: use const qualifier where it's possible debug: use const void * for ul_debugobj() libsmartcols: make get_line/column_separator() return const
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index 4040b4365..eb0998077 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -113,7 +113,6 @@ void scols_unref_table(struct libscols_table *tb)
}
}
-
/**
* scols_table_set_name:
* @tb: a pointer to a struct libscols_table instance
@@ -228,7 +227,6 @@ int scols_table_remove_columns(struct libscols_table *tb)
return 0;
}
-
/**
* scols_table_new_column:
* @tb: table
@@ -332,14 +330,13 @@ int scols_table_next_column(struct libscols_table *tb,
return rc;
}
-
/**
* scols_table_get_ncols:
* @tb: table
*
- * Returns: the ncols table member
+ * Returns: the ncols table member.
*/
-size_t scols_table_get_ncols(struct libscols_table *tb)
+size_t scols_table_get_ncols(const struct libscols_table *tb)
{
return tb->ncols;
}
@@ -348,9 +345,9 @@ size_t scols_table_get_ncols(struct libscols_table *tb)
* scols_table_get_nlines:
* @tb: table
*
- * Returns: the nlines table member, a negative number in case of an error.
+ * Returns: the nlines table member.
*/
-size_t scols_table_get_nlines(struct libscols_table *tb)
+size_t scols_table_get_nlines(const struct libscols_table *tb)
{
return tb->nlines;
}
@@ -383,7 +380,7 @@ int scols_table_set_stream(struct libscols_table *tb, FILE *stream)
*
* Returns: stream pointer, NULL in case of an error or an unset stream.
*/
-FILE *scols_table_get_stream(struct libscols_table *tb)
+FILE *scols_table_get_stream(const struct libscols_table *tb)
{
return tb->out;
}
@@ -917,7 +914,7 @@ int scols_table_enable_nowrap(struct libscols_table *tb, int enable)
*
* Returns: 1 if colors are enabled.
*/
-int scols_table_colors_wanted(struct libscols_table *tb)
+int scols_table_colors_wanted(const struct libscols_table *tb)
{
return tb->colors_wanted;
}
@@ -928,7 +925,7 @@ int scols_table_colors_wanted(struct libscols_table *tb)
*
* Returns: 1 if the table is empty.
*/
-int scols_table_is_empty(struct libscols_table *tb)
+int scols_table_is_empty(const struct libscols_table *tb)
{
return !tb->nlines;
}
@@ -939,7 +936,7 @@ int scols_table_is_empty(struct libscols_table *tb)
*
* Returns: 1 if ASCII tree is enabled.
*/
-int scols_table_is_ascii(struct libscols_table *tb)
+int scols_table_is_ascii(const struct libscols_table *tb)
{
return tb->ascii;
}
@@ -950,7 +947,7 @@ int scols_table_is_ascii(struct libscols_table *tb)
*
* Returns: 1 if header output is disabled.
*/
-int scols_table_is_noheadings(struct libscols_table *tb)
+int scols_table_is_noheadings(const struct libscols_table *tb)
{
return tb->no_headings;
}
@@ -961,7 +958,7 @@ int scols_table_is_noheadings(struct libscols_table *tb)
*
* Returns: 1 if export output format is enabled.
*/
-int scols_table_is_export(struct libscols_table *tb)
+int scols_table_is_export(const struct libscols_table *tb)
{
return tb->format == SCOLS_FMT_EXPORT;
}
@@ -972,7 +969,7 @@ int scols_table_is_export(struct libscols_table *tb)
*
* Returns: 1 if raw output format is enabled.
*/
-int scols_table_is_raw(struct libscols_table *tb)
+int scols_table_is_raw(const struct libscols_table *tb)
{
return tb->format == SCOLS_FMT_RAW;
}
@@ -985,19 +982,18 @@ int scols_table_is_raw(struct libscols_table *tb)
*
* Since: 2.27
*/
-int scols_table_is_json(struct libscols_table *tb)
+int scols_table_is_json(const struct libscols_table *tb)
{
return tb->format == SCOLS_FMT_JSON;
}
-
/**
* scols_table_is_maxout
* @tb: table
*
* Returns: 1 if output maximization is enabled or 0
*/
-int scols_table_is_maxout(struct libscols_table *tb)
+int scols_table_is_maxout(const struct libscols_table *tb)
{
return tb->maxout;
}
@@ -1008,7 +1004,7 @@ int scols_table_is_maxout(struct libscols_table *tb)
*
* Returns: returns 1 tree-like output is expected.
*/
-int scols_table_is_tree(struct libscols_table *tb)
+int scols_table_is_tree(const struct libscols_table *tb)
{
return tb->ntreecols > 0;
}
@@ -1048,7 +1044,7 @@ int scols_table_set_line_separator(struct libscols_table *tb, const char *sep)
*
* Returns: @tb column separator, NULL in case of an error
*/
-char *scols_table_get_column_separator(struct libscols_table *tb)
+const char *scols_table_get_column_separator(const struct libscols_table *tb)
{
return tb->colsep;
}
@@ -1059,10 +1055,9 @@ char *scols_table_get_column_separator(struct libscols_table *tb)
*
* Returns: @tb line separator, NULL in case of an error
*/
-char *scols_table_get_line_separator(struct libscols_table *tb)
+const char *scols_table_get_line_separator(const struct libscols_table *tb)
{
return tb->linesep;
-
}
static int cells_cmp_wrapper(struct list_head *a, struct list_head *b, void *data)
@@ -1126,7 +1121,7 @@ int scols_table_set_termforce(struct libscols_table *tb, int force)
*
* Returns: SCOLS_TERMFORCE_{NEVER,ALWAYS,AUTO} or a negative value in case of an error.
*/
-int scols_table_get_termforce(struct libscols_table *tb)
+int scols_table_get_termforce(const struct libscols_table *tb)
{
return tb->termforce;
}