diff options
author | Karel Zak | 2014-02-04 23:34:54 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-11 11:35:14 +0100 |
commit | 9a66e1e76fbde53ecf0e7684e5a942d96f4c9780 (patch) | |
tree | d0604666cdc168d1eafdff98b0814b5fc535fd36 | |
parent | libfdisk: add dump functions, make freespace code generic (diff) | |
download | kernel-qcow2-util-linux-9a66e1e76fbde53ecf0e7684e5a942d96f4c9780.tar.gz kernel-qcow2-util-linux-9a66e1e76fbde53ecf0e7684e5a942d96f4c9780.tar.xz kernel-qcow2-util-linux-9a66e1e76fbde53ecf0e7684e5a942d96f4c9780.zip |
lib/tt: add tt_line_get_userdata()
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | include/tt.h | 1 | ||||
-rw-r--r-- | lib/tt.c | 5 | ||||
-rw-r--r-- | misc-utils/findmnt.c | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/include/tt.h b/include/tt.h index 198ccdcb7..ae81d4f3b 100644 --- a/include/tt.h +++ b/include/tt.h @@ -97,6 +97,7 @@ extern struct tt_line *tt_add_line(struct tt *tb, struct tt_line *parent); extern int tt_line_set_data(struct tt_line *ln, int colnum, char *data); extern int tt_line_set_userdata(struct tt_line *ln, void *data); +extern void *tt_line_get_userdata(struct tt_line *ln); extern void tt_fputs_quoted(const char *data, FILE *out); extern void tt_fputs_nonblank(const char *data, FILE *out); @@ -310,6 +310,11 @@ int tt_line_set_userdata(struct tt_line *ln, void *data) return 0; } +void *tt_line_get_userdata(struct tt_line *ln) +{ + return ln ? ln->userdata : NULL; +} + static char *line_get_ascii_art(struct tt_line *ln, char *buf, size_t *bufsz) { const char *art; diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index dc1cbb745..874bd01c6 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -702,7 +702,7 @@ static int has_line(struct tt *tt, struct libmnt_fs *fs) list_for_each(p, &tt->tb_lines) { struct tt_line *ln = list_entry(p, struct tt_line, ln_lines); - if ((struct libmnt_fs *) ln->userdata == fs) + if ((struct libmnt_fs *) tt_line_get_userdata(ln) == fs) return 1; } return 0; |