aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-22 14:36:20 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-22 18:11:04 +0100
commitc6d76158b597d6c9bcfe222129d2897fececc45f (patch)
tree6aae2f997b019d51dc8916b8c08007e28d91ef11 /text.c
parent0f15c4af6c68edb3fa8e3331260e1da43121827f (diff)
downloadvis-c6d76158b597d6c9bcfe222129d2897fececc45f.tar.gz
vis-c6d76158b597d6c9bcfe222129d2897fececc45f.tar.xz
text: introduce EMARK to denote an invalid mark
Technically this macro name is in the reserved namespace of errno.h. The same is true for EPOS. Maybe we should rename them at some point, but for now the short names are convenient. Fix #443 Close #444
Diffstat (limited to 'text.c')
-rw-r--r--text.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/text.c b/text.c
index ace6b2d..0084ae3 100644
--- a/text.c
+++ b/text.c
@@ -1634,14 +1634,14 @@ Mark text_mark_set(Text *txt, size_t pos) {
return (Mark)&txt->end;
Location loc = piece_get_extern(txt, pos);
if (!loc.piece)
- return (Mark)NULL;
+ return EMARK;
return (Mark)(loc.piece->data + loc.off);
}
size_t text_mark_get(Text *txt, Mark mark) {
size_t cur = 0;
- if (!mark)
+ if (mark == EMARK)
return EPOS;
if (mark == (Mark)&txt->begin)
return 0;