summaryrefslogtreecommitdiffstats
path: root/unwind.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-11 23:51:05 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-11 23:51:05 -0800
commitfce7c87fa0099e5414607676fc73c9dfa9d7649c (patch)
tree6b080b309e798196061f8ad7e9a0c6ea6cbaa24b /unwind.c
parentaa2516fecfd6857206756efa891b058deceeb8dd (diff)
downloadtxr-fce7c87fa0099e5414607676fc73c9dfa9d7649c.tar.gz
txr-fce7c87fa0099e5414607676fc73c9dfa9d7649c.tar.bz2
txr-fce7c87fa0099e5414607676fc73c9dfa9d7649c.zip
Task #11486: continuation. Now able to @(skip) through
a large file horizontally under @(freeform) in constant memory. Position reporting is incorrect. * match.c (match_line_ctx): New member, base. (ml_all): Initialize new member to zero. (consume_prefix): New static function. (do_match_line): New static function, contains implementation of match_line. Calls consume_prefix. (match_line): Becomes a wrapper for do_match_line. (search_form, h_skip): Call consume_prefix. (freeform_prepare): New function. External to avoid inlining. (v_freeform): Uses do_match_line, to down context by reference, and also refactored to avoid spurious retention of c->data. * unwind.c (uw_push-block, uw_push_env, uw_push_debug, uw_push_catch): Zero out the structure, otherwise the unused fields can cause spurious retention.
Diffstat (limited to 'unwind.c')
-rw-r--r--unwind.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/unwind.c b/unwind.c
index bb081994..ac99665a 100644
--- a/unwind.c
+++ b/unwind.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <assert.h>
#include <setjmp.h>
#include <dirent.h>
@@ -98,6 +99,7 @@ static void uw_unwind_to_exit_point(void)
void uw_push_block(uw_frame_t *fr, val tag)
{
+ memset(fr, 0, sizeof *fr);
fr->bl.type = UW_BLOCK;
fr->bl.tag = tag;
fr->bl.result = nil;
@@ -113,6 +115,7 @@ static uw_frame_t *uw_find_env(void)
void uw_push_env(uw_frame_t *fr)
{
uw_frame_t *prev_env = uw_find_env();
+ memset(fr, 0, sizeof *fr);
fr->ev.type = UW_ENV;
fr->ev.up_env = prev_env;
fr->ev.func_bindings = nil;
@@ -161,6 +164,7 @@ void uw_push_debug(uw_frame_t *fr, val func, val args,
val ub_p_a_pairs, val env, val data,
val line, val chr)
{
+ memset(fr, 0, sizeof *fr);
fr->db.type = UW_DBG;
fr->db.func = func;
fr->db.args = args;
@@ -208,6 +212,7 @@ val uw_block_return(val tag, val result)
void uw_push_catch(uw_frame_t *fr, val matches)
{
+ memset(fr, 0, sizeof *fr);
fr->ca.type = UW_CATCH;
fr->ca.matches = matches;
fr->ca.exception = nil;