From 575a1de03a38bdcc9c9697041633732ea34f1021 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 22 Nov 2013 13:31:15 +0100 Subject: lib/tt: add tb_get_nlines() Signed-off-by: Karel Zak --- lib/tt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/tt.c b/lib/tt.c index 46fc00e87..e94524e86 100644 --- a/lib/tt.c +++ b/lib/tt.c @@ -223,6 +223,19 @@ void tt_set_stream(struct tt *tb, FILE *out) tb->out = out; } +size_t tb_get_nlines(struct tt *tb) +{ + struct list_head *p; + size_t ct = 0; + + if (tt_is_empty(tb)) + return 0; + + list_for_each(p, &tb->tb_lines) + ct++; + return ct; +} + void tt_remove_lines(struct tt *tb) { if (!tb) -- cgit v1.2.3-55-g7522