+Tue Mar 30 22:04:19 2004 Ben Pfaff <blp@gnu.org>
+
+ * 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 <blp@gnu.org>
* descript.c: (cmd_descriptives) Free `vars' to avoid memory leak.
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);
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;
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);
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(). */