From f0fd3b7578c1868b62db647a60ecf15cd9ed06f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 14 Aug 2021 09:56:14 +0200 Subject: [PATCH] selection: modify: replace reset_context() macro with a function --- selection.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/selection.c b/selection.c index 365975f0..f47e4920 100644 --- a/selection.c +++ b/selection.c @@ -536,6 +536,13 @@ mark_selected(struct terminal *term, struct row *row, struct cell *cell, return true; } +static void +reset_modify_context(struct mark_context *ctx) +{ + ctx->last_row = NULL; + ctx->empty_count = 0; +} + static void selection_modify(struct terminal *term, struct coord start, struct coord end) { @@ -543,11 +550,6 @@ selection_modify(struct terminal *term, struct coord start, struct coord end) xassert(start.row != -1 && start.col != -1); xassert(end.row != -1 && end.col != -1); -#define reset_context() do { \ - ctx.last_row = NULL; \ - ctx.empty_count = 0; \ - } while (0) - uint64_t **keep_selection = xcalloc(term->grid->num_rows, sizeof(keep_selection[0])); @@ -555,14 +557,14 @@ selection_modify(struct terminal *term, struct coord start, struct coord end) /* Premark all cells that *will* be selected */ foreach_selected(term, start, end, &premark_selected, &ctx); - reset_context(); + reset_modify_context(&ctx); if (term->selection.end.row >= 0) { /* Unmark previous selection, ignoring cells that are part of * the new selection */ foreach_selected(term, term->selection.start, term->selection.end, &unmark_selected, &ctx); - reset_context(); + reset_modify_context(&ctx); } term->selection.start = start; @@ -578,8 +580,6 @@ selection_modify(struct terminal *term, struct coord start, struct coord end) free(keep_selection[i]); } free(keep_selection); - -#undef reset_context } static void