projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify multipass_procedure().
[pspp]
/
src
/
data
/
procedure.c
diff --git
a/src/data/procedure.c
b/src/data/procedure.c
index 16dcd745929f9962d489fd58f66bcd4110fcfc13..a2ca8b23ee85f8b51285a6c8f61c422911f06638 100644
(file)
--- a/
src/data/procedure.c
+++ b/
src/data/procedure.c
@@
-47,7
+47,7
@@
struct write_case_data
struct ccase trns_case; /* Case used for transformations. */
struct ccase sink_case; /* Case written to sink, if
struct ccase trns_case; /* Case used for transformations. */
struct ccase sink_case; /* Case written to sink, if
- compacti
on
is necessary. */
+ compacti
ng
is necessary. */
size_t cases_written; /* Cases output so far. */
};
size_t cases_written; /* Cases output so far. */
};
@@
-281,8
+281,8
@@
open_active_file (void)
if (permanent_dict == NULL)
permanent_dict = default_dict;
if (permanent_dict == NULL)
permanent_dict = default_dict;
- /* Figure out
compaction
. */
- compactor = (dict_
needs_compaction
(permanent_dict)
+ /* Figure out
whether to compact
. */
+ compactor = (dict_
compacting_would_shrink
(permanent_dict)
? dict_make_compactor (permanent_dict)
: NULL);
? dict_make_compactor (permanent_dict)
: NULL);
@@
-411,7
+411,7
@@
close_active_file (void)
/* Dictionary from before TEMPORARY becomes permanent. */
proc_cancel_temporary_transformations ();
/* Dictionary from before TEMPORARY becomes permanent. */
proc_cancel_temporary_transformations ();
- /* Finish compacti
on
. */
+ /* Finish compacti
ng
. */
if (compactor != NULL)
{
dict_compactor_destroy (compactor);
if (compactor != NULL)
{
dict_compactor_destroy (compactor);
@@
-458,7
+458,6
@@
lagged_case (int n_before)
/* Represents auxiliary data for handling SPLIT FILE. */
struct split_aux_data
{
/* Represents auxiliary data for handling SPLIT FILE. */
struct split_aux_data
{
- size_t case_count; /* Number of cases so far. */
struct ccase prev_case; /* Data in previous case. */
/* Callback functions. */
struct ccase prev_case; /* Data in previous case. */
/* Callback functions. */
@@
-498,7
+497,6
@@
procedure_with_splits (void (*begin_func) (const struct ccase *, void *aux),
struct split_aux_data split_aux;
bool ok;
struct split_aux_data split_aux;
bool ok;
- split_aux.case_count = 0;
case_nullify (&split_aux.prev_case);
split_aux.begin_func = begin_func;
split_aux.proc_func = proc_func;
case_nullify (&split_aux.prev_case);
split_aux.begin_func = begin_func;
split_aux.proc_func = proc_func;
@@
-520,10
+518,10
@@
split_procedure_case_func (const struct ccase *c, void *split_aux_)
struct split_aux_data *split_aux = split_aux_;
/* Start a new series if needed. */
struct split_aux_data *split_aux = split_aux_;
/* Start a new series if needed. */
- if (
split_aux->case_count == 0
+ if (
case_is_null (&split_aux->prev_case)
|| !equal_splits (c, &split_aux->prev_case))
{
|| !equal_splits (c, &split_aux->prev_case))
{
- if (
split_aux->case_count > 0
&& split_aux->end_func != NULL)
+ if (
!case_is_null (&split_aux->prev_case)
&& split_aux->end_func != NULL)
split_aux->end_func (split_aux->func_aux);
case_destroy (&split_aux->prev_case);
split_aux->end_func (split_aux->func_aux);
case_destroy (&split_aux->prev_case);
@@
-533,7
+531,6
@@
split_procedure_case_func (const struct ccase *c, void *split_aux_)
split_aux->begin_func (&split_aux->prev_case, split_aux->func_aux);
}
split_aux->begin_func (&split_aux->prev_case, split_aux->func_aux);
}
- split_aux->case_count++;
return (split_aux->proc_func == NULL
|| split_aux->proc_func (c, split_aux->func_aux));
}
return (split_aux->proc_func == NULL
|| split_aux->proc_func (c, split_aux->func_aux));
}
@@
-544,7
+541,7
@@
split_procedure_end_func (void *split_aux_)
{
struct split_aux_data *split_aux = split_aux_;
{
struct split_aux_data *split_aux = split_aux_;
- if (
split_aux->case_count > 0
&& split_aux->end_func != NULL)
+ if (
!case_is_null (&split_aux->prev_case)
&& split_aux->end_func != NULL)
split_aux->end_func (split_aux->func_aux);
return true;
}
split_aux->end_func (split_aux->func_aux);
return true;
}
@@
-802,6
+799,7
@@
void
proc_done (void)
{
discard_variables ();
proc_done (void)
{
discard_variables ();
+ dict_destroy (default_dict);
}
/* Sets SINK as the destination for procedure output from the
}
/* Sets SINK as the destination for procedure output from the