From b8dd2901f9e205f330fca47cbd3984270b5d60b1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 3 Mar 2018 16:01:50 +0100 Subject: Remove text_run offsets and lengths Keeping these up to date was becoming a gigantic headache. So instead of storing the values, routines which are interested in these lengths and offsets can calculate them themselves. --- src/sc_parse.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/sc_parse.c') diff --git a/src/sc_parse.c b/src/sc_parse.c index 2607031..26f9303 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -746,6 +746,12 @@ size_t scblock_delete_text(SCBlock *b, ssize_t o1, ssize_t o2) return 0; } + if ( (o2 != -1) && (o1 > o2) ) { + ssize_t t = o2; + o2 = o1; + o1 = t; + } + len = strlen(b->contents); if ( o2 < 0 ) o2 = len; if ( (o1 >= o2) || (o1 > len) || (o2 > len) ) { -- cgit v1.2.3