From ffaa19ee22ec00da01d23748f78253ad5c2253de Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 15 Jul 2020 11:31:57 +0200 Subject: selection: provide a const-wrapper for extract_one() extract_one() takes const pointers, while the callback argument to foreach() expects non-const. --- selection.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/selection.c b/selection.c index eb21d318..d5add464 100644 --- a/selection.c +++ b/selection.c @@ -195,6 +195,14 @@ foreach_selected( assert(false); } +static bool +extract_one_const_wrapper(struct terminal *term, + struct row *row, struct cell *cell, + int col, void *data) +{ + return extract_one(term, row, cell, col, data); +} + static char * extract_selection(const struct terminal *term) { @@ -204,7 +212,7 @@ extract_selection(const struct terminal *term) foreach_selected( (struct terminal *)term, term->selection.start, term->selection.end, - &extract_one, ctx); + &extract_one_const_wrapper, ctx); char *text; return extract_finish(ctx, &text, NULL) ? text : NULL; -- cgit v1.3