summaryrefslogtreecommitdiff
path: root/otherlibs/str/strstubs.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/str/strstubs.c')
-rw-r--r--otherlibs/str/strstubs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/otherlibs/str/strstubs.c b/otherlibs/str/strstubs.c
index 51d7b79687..03a85c10cb 100644
--- a/otherlibs/str/strstubs.c
+++ b/otherlibs/str/strstubs.c
@@ -130,7 +130,8 @@ static unsigned char re_word_letters[32] = {
static value re_alloc_groups(value re, unsigned char * starttxt,
struct re_group * groups)
{
- value res;
+ CAMLparam1(re);
+ CAMLlocal1(res);
int n = Numgroups(re);
int i;
struct re_group * group;
@@ -146,9 +147,10 @@ static value re_alloc_groups(value re, unsigned char * starttxt,
Field(res, i * 2 + 1) = Val_long(group->end - starttxt);
}
}
- return res;
+ CAMLreturn(res);
}
+
/* The bytecode interpreter for the NFA.
Return Caml array of matched groups on success, 0 on failure. */
@@ -185,7 +187,7 @@ static value re_match(value re,
*q = NULL;
}
- pc = &Field(Prog(re), 0);
+ pc = Op_val(Prog(re));
stack = &initial_stack;
sp = stack->point;
cpool = Cpool(re);
@@ -532,8 +534,8 @@ CAMLprim value re_replacement_text(value repl, value groups, value orig)
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
c -= '0';
- start = Long_val(Field(groups, c*2));
- end = Long_val(Field(groups, c*2 + 1));
+ start = Long_field(groups, c*2);
+ end = Long_field(groups, c*2 + 1);
len = end - start;
memmove (q, &Byte(orig, start), len);
q += len;