From c17ca10e11db30f4b4924b69dbf3b1693025d4dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 13 Sep 2014 22:25:06 +0200 Subject: Introduce and use EPOS instead of (size_t)-1 --- text.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'text.c') diff --git a/text.c b/text.c index a9685e4..4f1f28e 100644 --- a/text.c +++ b/text.c @@ -1087,8 +1087,8 @@ int text_search_range_forward(Text *txt, size_t pos, size_t len, Regex *r, size_ int ret = regexec(&r->regex, buf, nmatch, match, eflags); if (!ret) { for (size_t i = 0; i < nmatch; i++) { - pmatch[i].start = match[i].rm_so == -1 ? (size_t)-1 : pos + match[i].rm_so; - pmatch[i].end = match[i].rm_eo == -1 ? (size_t)-1 : pos + match[i].rm_eo; + pmatch[i].start = match[i].rm_so == -1 ? EPOS : pos + match[i].rm_so; + pmatch[i].end = match[i].rm_eo == -1 ? EPOS : pos + match[i].rm_eo; } } free(buf); @@ -1107,8 +1107,8 @@ int text_search_range_backward(Text *txt, size_t pos, size_t len, Regex *r, size while (!regexec(&r->regex, cur, nmatch, match, eflags)) { ret = 0; for (size_t i = 0; i < nmatch; i++) { - pmatch[i].start = match[i].rm_so == -1 ? (size_t)-1 : pos + (size_t)(cur - buf) + match[i].rm_so; - pmatch[i].end = match[i].rm_eo == -1 ? (size_t)-1 : pos + (size_t)(cur - buf) + match[i].rm_eo; + pmatch[i].start = match[i].rm_so == -1 ? EPOS : pos + (size_t)(cur - buf) + match[i].rm_so; + pmatch[i].end = match[i].rm_eo == -1 ? EPOS : pos + (size_t)(cur - buf) + match[i].rm_eo; } cur += match[0].rm_eo; } -- cgit v1.2.3