summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-07 07:21:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-07 07:21:02 -0700
commita31ad16733b6da5a45803a9482e330d17f690636 (patch)
tree4bc8f872f823a0020652c6c6fe86c697982ec7a7 /regex.c
parentdcc75348c720acd6c2a0587bca34f7851e6c1283 (diff)
downloadtxr-a31ad16733b6da5a45803a9482e330d17f690636.tar.gz
txr-a31ad16733b6da5a45803a9482e330d17f690636.tar.bz2
txr-a31ad16733b6da5a45803a9482e330d17f690636.zip
Don't use prot1 for temporary gc protection.
* lib.c (split_str, split_str_set, list_str, int_str): Use gc_hint rather than prot1/rel1. More efficient, doesn't use space in the prot_stack array. * regex.c (search_regex): Likewise. * stream.c (vformat_str, formatv, run): Likewise. In formatv, rel1 wasn't being called in the uw_unwind block, so this fixes a bug.
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/regex.c b/regex.c
index fa31016d..fa825ab3 100644
--- a/regex.c
+++ b/regex.c
@@ -1981,8 +1981,6 @@ val search_regex(val haystack, val needle_regex, val start,
cnum s = c_num(start);
const wchar_t *h = c_str(haystack);
- prot1(&haystack);
-
for (i = c_num(length_str(haystack)) - 1; i >= s; i--) {
cnum span = regex_run(needle_regex, h + i);
if (span >= 0) {
@@ -1991,7 +1989,7 @@ val search_regex(val haystack, val needle_regex, val start,
}
}
- rel1(&haystack);
+ gc_hint(haystack);
} else {
regex_machine_t regm;
val i, pos = start, retval;