summaryrefslogtreecommitdiff
path: root/libguile/regex-posix.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2004-09-28 23:50:21 +0000
committerKevin Ryde <user42@zip.com.au>2004-09-28 23:50:21 +0000
commit21682b207e95c313cc92b4bf179b9c3c28bcb801 (patch)
tree3d08cfa1db5f23204aeb6fc10eebd15236bb88ae /libguile/regex-posix.c
parent5cc183a12f7f6ff917c700867dd4a05ff88bc248 (diff)
downloadguile-21682b207e95c313cc92b4bf179b9c3c28bcb801.tar.gz
(scm_regexp_exec): Correction to last change, should
be whole original string in match struct, not offsetted substring.
Diffstat (limited to 'libguile/regex-posix.c')
-rw-r--r--libguile/regex-posix.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libguile/regex-posix.c b/libguile/regex-posix.c
index 1ffbb35b6..1e9333ba7 100644
--- a/libguile/regex-posix.c
+++ b/libguile/regex-posix.c
@@ -220,15 +220,19 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
regmatch_t *matches;
char *c_str;
SCM mvec = SCM_BOOL_F;
+ SCM substr;
SCM_VALIDATE_RGXP (1, rx);
SCM_VALIDATE_STRING (2, str);
if (SCM_UNBNDP (start))
- offset = 0;
+ {
+ substr = str;
+ offset = 0;
+ }
else
{
- str = scm_substring (str, start, SCM_UNDEFINED);
+ substr = scm_substring (str, start, SCM_UNDEFINED);
offset = scm_to_int (start);
}
@@ -241,7 +245,7 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
nmatches = SCM_RGX(rx)->re_nsub + 1;
SCM_DEFER_INTS;
matches = scm_malloc (sizeof (regmatch_t) * nmatches);
- c_str = scm_to_locale_string (str);
+ c_str = scm_to_locale_string (substr);
status = regexec (SCM_RGX (rx), c_str, nmatches, matches,
scm_to_int (flags));
free (c_str);