From c6d76158b597d6c9bcfe222129d2897fececc45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 22 Dec 2016 14:36:20 +0100 Subject: 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 --- text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'text.c') 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; -- cgit v1.2.3