From 9b4b94c6d3b5fd98bf396e23d015380b87d2d296 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 31 Mar 2004 06:07:03 +0000 Subject: [PATCH] Had to get last call to multipass_split_output() inside open_active_file()/close_active_file() pairing. --- src/ChangeLog | 12 ++++++++++++ src/vfm.c | 22 ++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 36aba042..5514d1f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +Tue Mar 30 22:04:19 2004 Ben Pfaff + + * vfm.c: Had to get last call to multipass_split_output() inside + open_active_file()/close_active_file() pairing, so introduce new + function. + (internal_procedure) Move procedure() code here, except for calls + to open_active_file() and close_active_file(). + (procedure) Wrap open_active_file() and close_active_file() around + internal_procedure(). + (multipass_procedure_with_splits) Wrap open_active_file() and + close_active_file() around internal_procedure(). + Tue Mar 30 22:01:57 2004 Ben Pfaff * descript.c: (cmd_descriptives) Free `vars' to avoid memory leak. diff --git a/src/vfm.c b/src/vfm.c index bfd1ef01..09c132f7 100644 --- a/src/vfm.c +++ b/src/vfm.c @@ -83,6 +83,8 @@ static int lag_count; /* Number of cases in lag_queue so far. */ static int lag_head; /* Index where next case will be added. */ static struct ccase **lag_queue; /* Array of n_lag ccase * elements. */ +static void internal_procedure (int (*proc_func) (struct ccase *, void *), + void *aux); static struct ccase *create_trns_case (struct dictionary *); static void open_active_file (void); static int write_case (struct write_case_data *wc_data); @@ -122,6 +124,17 @@ static void close_active_file (void); 7. Pass case to PROC_FUNC, passing AUX as auxiliary data. */ void procedure (int (*proc_func) (struct ccase *, void *), void *aux) +{ + open_active_file (); + internal_procedure (proc_func, aux); + close_active_file (); +} + +/* Executes a procedure, as procedure(), except that the caller + is responsible for calling open_active_file() and + close_active_file(). */ +static void +internal_procedure (int (*proc_func) (struct ccase *, void *), void *aux) { static int recursive_call; @@ -137,12 +150,10 @@ procedure (int (*proc_func) (struct ccase *, void *), void *aux) last_vfm_invocation = time (NULL); - open_active_file (); if (vfm_source != NULL) vfm_source->class->read (vfm_source, wc_data.trns_case, write_case, &wc_data); - close_active_file (); free (wc_data.sink_case); free (wc_data.trns_case); @@ -868,16 +879,19 @@ multipass_procedure_with_splits (void (*split_func) (const struct casefile *, assert (split_func != NULL); + open_active_file (); + aux.prev_case = xmalloc (dict_get_case_size (default_dict)); aux.casefile = NULL; aux.split_func = split_func; aux.func_aux = func_aux; - - procedure (multipass_split_callback, &aux); + internal_procedure (multipass_split_callback, &aux); if (aux.casefile != NULL) multipass_split_output (&aux); free (aux.prev_case); + + close_active_file (); } /* procedure() callback used by multipass_procedure_with_splits(). */ -- 2.30.2