summaryrefslogtreecommitdiff
path: root/tests/helpers/term_api.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helpers/term_api.h')
-rw-r--r--tests/helpers/term_api.h23
1 files changed, 3 insertions, 20 deletions
diff --git a/tests/helpers/term_api.h b/tests/helpers/term_api.h
index bfa8d71..f2d6a5d 100644
--- a/tests/helpers/term_api.h
+++ b/tests/helpers/term_api.h
@@ -137,35 +137,18 @@ static inline void tt_select(struct term *t, int x1, int y1, int x2, int y2)
/* NULL when nothing is selected. */
static inline char *tt_selection_text(const struct term *t)
{
- size_t n = term_selection_text(t, NULL, 0);
- if (!n)
- return NULL;
- char *text = malloc(n + 1);
- if (text)
- term_selection_text(t, text, n + 1);
- return text;
+ return term_selection_text(t);
}
static inline char *tt_history_text(struct term *t, int max_rows)
{
- size_t n = term_history_text(t, max_rows, NULL, 0);
- char *text = malloc(n + 1);
- if (text)
- term_history_text(t, max_rows, text, n + 1);
- return text;
+ return term_history_text(t, max_rows);
}
/* NULL when there is no link. */
static inline char *tt_link_at(struct term *t, int col, int row)
{
- struct term_vector2i cell = { .x = col, .y = row };
- size_t n = term_link_at(t, cell, NULL, 0);
- if (!n)
- return NULL;
- char *url = malloc(n + 1);
- if (url)
- term_link_at(t, cell, url, n + 1);
- return url;
+ return term_link_at(t, (struct term_vector2i){ .x = col, .y = row });
}
static inline bool tt_resize(struct term *t, int cols, int rows)