#include <language/dictionary/split-file.h>
#include <language/lexer/lexer.h>
#include <language/lexer/variable-parser.h>
-#include <libpspp/alloc.h>
#include <libpspp/array.h>
#include <libpspp/compiler.h>
-#include <libpspp/magic.h>
#include <libpspp/message.h>
#include <libpspp/assertion.h>
#include <math/moments.h>
#include <output/manager.h>
#include <output/table.h>
+#include "xalloc.h"
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
struct dsc_var
{
const struct variable *v; /* Variable to calculate on. */
- char z_name[LONG_NAME_LEN + 1]; /* Name for z-score variable. */
+ char z_name[VAR_NAME_LEN + 1]; /* Name for z-score variable. */
double valid, missing; /* Valid, missing counts. */
struct moments *moments; /* Moments. */
double min, max; /* Maximum and mimimum values. */
generate_z_varname (const struct dictionary *dict, struct dsc_proc *dsc, char *z_name,
const char *var_name, int *z_cnt)
{
- char name[LONG_NAME_LEN + 1];
+ char name[VAR_NAME_LEN + 1];
/* Try a name based on the original variable name. */
name[0] = 'Z';
size_t i;
if (!casereader_peek (group, 0, &c))
- return;
+ {
+ casereader_destroy (group);
+ return;
+ }
output_split_file_values (ds, &c);
case_destroy (&c);
group = casereader_create_filter_weight (group, dataset_dict (ds),
NULL, NULL);
- casereader_split (group, &pass1, &pass2);
- if (dsc->max_moment <= MOMENT_MEAN)
- casereader_destroy (pass2);
+ pass1 = group;
+ pass2 = dsc->max_moment <= MOMENT_MEAN ? NULL : casereader_clone (pass1);
for (i = 0; i < dsc->var_cnt; i++)
{
}
}
if (!casereader_destroy (pass1))
- return;
+ {
+ casereader_destroy (pass2);
+ return;
+ }
/* Second pass for higher-order moments. */
if (dsc->max_moment > MOMENT_MEAN)