summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-04-01 07:52:07 +0000
committernicm <nicm@openbsd.org>2020-04-01 07:52:07 +0000
commit4bd2e257c51327f751644b966161535401669363 (patch)
treed53de4a9343879cb830e750a7d7f961e3225d24e
parentPerformance improvements for regex searching, most notably: (diff)
downloadwireguard-openbsd-4bd2e257c51327f751644b966161535401669363.tar.xz
wireguard-openbsd-4bd2e257c51327f751644b966161535401669363.zip
Use a comparison to check for wrap and avoid an expensive modulus.
-rw-r--r--usr.bin/tmux/window-copy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index e377d054f77..4ccf29ee479 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.260 2020/04/01 07:35:10 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.261 2020/04/01 07:52:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2523,8 +2523,9 @@ window_copy_cstrtocellpos(struct grid *gd, u_int ncells, u_int *ppx, u_int *ppy,
cells[cell].d = window_copy_cellstring(gl, px,
&cells[cell].dlen);
cell++;
- px = (px + 1) % gd->sx;
- if (px == 0) {
+ px++;
+ if (px == gd->sx) {
+ px = 0;
pywrap++;
gl = grid_peek_line(gd, pywrap);
}