mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
(scm_regexp_exec): Correction to last change, should
be whole original string in match struct, not offsetted substring.
This commit is contained in:
parent
5cc183a12f
commit
21682b207e
1 changed files with 7 additions and 3 deletions
|
@ -220,15 +220,19 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
|
||||||
regmatch_t *matches;
|
regmatch_t *matches;
|
||||||
char *c_str;
|
char *c_str;
|
||||||
SCM mvec = SCM_BOOL_F;
|
SCM mvec = SCM_BOOL_F;
|
||||||
|
SCM substr;
|
||||||
|
|
||||||
SCM_VALIDATE_RGXP (1, rx);
|
SCM_VALIDATE_RGXP (1, rx);
|
||||||
SCM_VALIDATE_STRING (2, str);
|
SCM_VALIDATE_STRING (2, str);
|
||||||
|
|
||||||
if (SCM_UNBNDP (start))
|
if (SCM_UNBNDP (start))
|
||||||
|
{
|
||||||
|
substr = str;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str = scm_substring (str, start, SCM_UNDEFINED);
|
substr = scm_substring (str, start, SCM_UNDEFINED);
|
||||||
offset = scm_to_int (start);
|
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;
|
nmatches = SCM_RGX(rx)->re_nsub + 1;
|
||||||
SCM_DEFER_INTS;
|
SCM_DEFER_INTS;
|
||||||
matches = scm_malloc (sizeof (regmatch_t) * nmatches);
|
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,
|
status = regexec (SCM_RGX (rx), c_str, nmatches, matches,
|
||||||
scm_to_int (flags));
|
scm_to_int (flags));
|
||||||
free (c_str);
|
free (c_str);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue