list_del(&cl->cl_columns);
scols_reset_cell(&cl->header);
free(cl->color);
+ free(cl->safechars);
free(cl->pending_data_buf);
free(cl);
}
*
* Returns: pointer to the table where columns is used
*/
-struct libscols_table *scols_column_get_table(struct libscols_column *cl)
+struct libscols_table *scols_column_get_table(const struct libscols_column *cl)
{
return cl->table;
}
* @data: string
* @userdata: callback private data
*
- * This is build-in function for scols_column_set_wrapfunc(). This function
+ * This is built-in function for scols_column_set_wrapfunc(). This function
* terminates the current chunk by \0 and returns pointer to the begin of
* the next chunk. The chunks are based on \n.
*
*/
int scols_column_set_safechars(struct libscols_column *cl, const char *safe)
{
- if (!cl)
- return -EINVAL;
- cl->safechars = safe;
- return 0;
+ return strdup_to_struct_member(cl, safechars, safe);
}
/**
extern struct libscols_cell *scols_column_get_header(struct libscols_column *cl);
extern int scols_column_set_color(struct libscols_column *cl, const char *color);
extern const char *scols_column_get_color(const struct libscols_column *cl);
-extern struct libscols_table *scols_column_get_table(struct libscols_column *cl);
+extern struct libscols_table *scols_column_get_table(const struct libscols_column *cl);
extern int scols_column_set_cmpfunc(struct libscols_column *cl,
int (*cmp)(struct libscols_cell *a,
int flags;
int is_extreme;
char *color; /* default column color */
+ char *safechars; /* do not encode this bytes */
char *pending_data;
size_t pending_data_sz;
char *, void *);
void *wrapfunc_data;
- const char *safechars; /* do not encode this bytes */
struct libscols_cell header;
struct list_head cl_columns;