aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-15 09:31:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-15 09:31:57 +0000
commitffaa19ee22ec00da01d23748f78253ad5c2253de (patch)
treea63558212dbdb1783fa69bb82739f8f884e08d5b
parentextract: extract_one: make arguments const (diff)
selection: provide a const-wrapper for extract_one()
extract_one() takes const pointers, while the callback argument to foreach() expects non-const.
-rw-r--r--selection.c10
1 files changed, 9 insertions, 1 deletions
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;