summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-09-23 13:38:09 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-09-23 20:05:44 +0200
commitb4170aed36e667e52ce4a353bda1964e3872ab34 (patch)
treea85852cf4a619c6782224dd7e86cc18c310bcd01 /src/libsystemd-terminal
parentce540a24d53e1751a5b69224d5a7f5a59f2de7ad (diff)
terminal: fix tile-offset calculation
Binary operators with two pointers as arguments always operate on object-size, not bytes. That is, "int *a, *b", (a - b) calculates the number of integers between b and a, not the number of bytes. Fix our cache-offset calculation to not use sizeof() with full-ptr arithmetic.
Diffstat (limited to 'src/libsystemd-terminal')
-rw-r--r--src/libsystemd-terminal/grdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd-terminal/grdev.c b/src/libsystemd-terminal/grdev.c
index c5ea524c69..80a71beeb9 100644
--- a/src/libsystemd-terminal/grdev.c
+++ b/src/libsystemd-terminal/grdev.c
@@ -345,7 +345,7 @@ const grdev_display_target *grdev_display_next_target(grdev_display *display, co
assert(cache->pipe->tile->display == display);
assert(display->pipes >= cache);
- idx = (cache - display->pipes) / sizeof(*cache) + 1;
+ idx = cache - display->pipes + 1;
} else {
idx = 0;
}