aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-05-03 10:54:02 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-05-03 11:07:05 +0200
commitdc012cb59daa9f5425871ef94e001f4dbdecc5a4 (patch)
tree83389f7d37a2f4319e4b8a1f23fc501100b158fa /text.c
parent596e9ac6b361a726f97c390bc272f6c7506d3cb5 (diff)
downloadvis-dc012cb59daa9f5425871ef94e001f4dbdecc5a4.tar.gz
vis-dc012cb59daa9f5425871ef94e001f4dbdecc5a4.tar.xz
text: rename text_sigbus to text_mmaped
Add casts to uintptr_t to avoid unrelated pointer comparisons.
Diffstat (limited to 'text.c')
-rw-r--r--text.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/text.c b/text.c
index 0d337c3..291cc3a 100644
--- a/text.c
+++ b/text.c
@@ -1312,10 +1312,11 @@ bool text_modified(Text *txt) {
return txt->saved_revision != txt->history;
}
-bool text_sigbus(Text *txt, const char *addr) {
+bool text_mmaped(Text *txt, const char *ptr) {
+ uintptr_t addr = (uintptr_t)ptr;
for (Block *blk = txt->blocks; blk; blk = blk->next) {
if ((blk->type == MMAP_ORIG || blk->type == MMAP) &&
- blk->data <= addr && addr < blk->data + blk->size)
+ (uintptr_t)(blk->data) <= addr && addr < (uintptr_t)(blk->data + blk->size))
return true;
}
return false;