diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-14 09:03:53 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-14 09:03:53 +0200 |
| commit | 7338b80cc8d6eb2e49f6559d1ede9b7f6714808d (patch) | |
| tree | 504fd79eccf80967f9bbee270e7149e7a98b3bf6 | |
| parent | 87f3451f2d2e992da862bce71816fbeb548513c8 (diff) | |
| download | vis-7338b80cc8d6eb2e49f6559d1ede9b7f6714808d.tar.gz vis-7338b80cc8d6eb2e49f6559d1ede9b7f6714808d.tar.xz | |
Use EPOS where appropriate
| -rw-r--r-- | text.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -549,7 +549,7 @@ bool text_insert(Text *txt, size_t pos, const char *data, size_t len) { } size_t text_undo(Text *txt) { - size_t pos = -1; + size_t pos = EPOS; /* taking a snapshot makes sure that txt->current_action is reset */ text_snapshot(txt); Action *a = action_pop(&txt->undo); @@ -566,7 +566,7 @@ size_t text_undo(Text *txt) { } size_t text_redo(Text *txt) { - size_t pos = -1; + size_t pos = EPOS; Action *a = action_pop(&txt->redo); if (!a) return pos; @@ -1032,7 +1032,7 @@ void text_mark_set(Text *txt, Mark mark, size_t pos) { size_t text_mark_get(Text *txt, Mark mark) { if (mark < 0 || mark >= LENGTH(txt->marks)) - return -1; + return EPOS; const char *pos = txt->marks[mark]; size_t cur = 0; for (Piece *p = txt->begin.next; p->next; p = p->next) { @@ -1041,7 +1041,7 @@ size_t text_mark_get(Text *txt, Mark mark) { cur += p->len; } - return -1; + return EPOS; } void text_mark_clear(Text *txt, Mark mark) { |
