summaryrefslogtreecommitdiff
path: root/libguile/regex-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/regex-posix.c')
-rw-r--r--libguile/regex-posix.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c
index 0ac816c07..9b1ec0767 100644
--- a/libguile/regex-posix.c
+++ b/libguile/regex-posix.c
@@ -252,8 +252,12 @@ scm_regexp_exec (SCM rx, SCM str, SCM start, SCM flags)
mvec = scm_make_vector (SCM_MAKINUM (nmatches + 1), SCM_UNSPECIFIED);
SCM_VELTS(mvec)[0] = str;
for (i = 0; i < nmatches; ++i)
- SCM_VELTS(mvec)[i+1] = scm_cons(SCM_MAKINUM(matches[i].rm_so + offset),
- SCM_MAKINUM(matches[i].rm_eo + offset));
+ if (matches[i].rm_so == -1)
+ SCM_VELTS(mvec)[i+1] = scm_cons (SCM_MAKINUM (-1), SCM_MAKINUM (-1));
+ else
+ SCM_VELTS(mvec)[i+1]
+ = scm_cons(SCM_MAKINUM(matches[i].rm_so + offset),
+ SCM_MAKINUM(matches[i].rm_eo + offset));
}
scm_must_free ((char *) matches);
SCM_ALLOW_INTS;