size_t var_count = n_sets + string_set_count (&var_names);
/* Allocate an array of var_or_mrset pointers (initially null). */
- struct var_or_mrset *var_or_mrset_array = xcalloc (
- var_count, sizeof *var_or_mrset_array);
+ struct var_or_mrset *var_or_mrset_array
+ = XCALLOC (var_count, struct var_or_mrset);
/* Fill the array. */
struct string_set added_mrsets = STRING_SET_INITIALIZER (added_mrsets);
/* Make an initial pass to populate our temporary matrix */
struct casereader *pass0 = casereader_clone (casereader0);
struct ccase *c;
- union value *prev_values = xcalloc (mformat->n_split_vars, sizeof *prev_values);
+ union value *prev_values = XCALLOC (mformat->n_split_vars, union value);
int row = (mformat->triangle == LOWER && mformat->diagonal == NO_DIAGONAL) ? 1 : 0;
bool first_case = true;
for (; (c = casereader_read (pass0)) != NULL; case_unref (c))
mm->mean_matrix = mr->mean_vectors;
mm->var_matrix = mr->var_vectors;
- struct substring *var_names = xcalloc (n_vars, sizeof *var_names);
+ struct substring *var_names = XCALLOC (n_vars, struct substring);
for (int i = 0; i < n_vars; ++i)
{
ss_alloc_substring (var_names + i, ss_cstr (var_get_name (vars[i])));
bool warn = true;
double sigma_t = 0.0;
- struct datum *row = xcalloc (ost->n_vars, sizeof *row);
+ struct datum *row = XCALLOC (ost->n_vars, struct datum);
double rsq;
struct friedman fr;
fr.rank_sum = xcalloc (ost->n_vars, sizeof *fr.rank_sum);
const gsl_matrix *cm = covariance_calculate_unnormalized (cov);
size_t i;
size_t k;
- bool *model_dropped = xcalloc (covariance_dim (cov), sizeof (*model_dropped));
- bool *submodel_dropped = xcalloc (covariance_dim (cov), sizeof (*submodel_dropped));
+ bool *model_dropped = XCALLOC (covariance_dim (cov), bool);
+ bool *submodel_dropped = XCALLOC (covariance_dim (cov), bool);
const struct categoricals *cats = covariance_get_categoricals (cov);
size_t n_dropped_model = 0;
const gsl_matrix *cm = covariance_calculate_unnormalized (cov);
size_t i;
size_t k;
- bool *model_dropped = xcalloc (covariance_dim (cov), sizeof (*model_dropped));
- bool *submodel_dropped = xcalloc (covariance_dim (cov), sizeof (*submodel_dropped));
+ bool *model_dropped = XCALLOC (covariance_dim (cov), bool);
+ bool *submodel_dropped = XCALLOC (covariance_dim (cov), bool);
const struct categoricals *cats = covariance_get_categoricals (cov);
for (k = 0; k < cmd->n_interactions; k++)
const gsl_matrix *cm = covariance_calculate_unnormalized (cov);
size_t i;
size_t k;
- bool *model_dropped = xcalloc (covariance_dim (cov), sizeof (*model_dropped));
- bool *submodel_dropped = xcalloc (covariance_dim (cov), sizeof (*submodel_dropped));
+ bool *model_dropped = XCALLOC (covariance_dim (cov), bool);
+ bool *submodel_dropped = XCALLOC (covariance_dim (cov), bool);
const struct categoricals *cats = covariance_get_categoricals (cov);
double ss0;
int total_n_groups = 0.0;
- struct kw *kw = xcalloc (nst->n_vars, sizeof *kw);
+ struct kw *kw = XCALLOC (nst->n_vars, struct kw);
/* If the independent variable is missing, then we ignore the case */
input = casereader_create_filter_missing (input,
int v;
struct casereader *r = casereader_clone (input);
- struct ks *ks = xcalloc (ost->n_vars, sizeof *ks);
+ struct ks *ks = XCALLOC (ost->n_vars, struct ks);
for (v = 0; v < ost->n_vars; ++v)
{
const struct caseproto *proto = casereader_get_proto (input);
size_t rank_idx = caseproto_get_n_widths (proto);
- struct mw *mw = xcalloc (nst->n_vars, sizeof *mw);
+ struct mw *mw = XCALLOC (nst->n_vars, struct mw);
for (i = 0; i < nst->n_vars; ++i)
{
struct casereader *r = input;
- struct mcnemar *mc = xcalloc (t2s->n_pairs, sizeof *mc);
+ struct mcnemar *mc = XCALLOC (t2s->n_pairs, struct mcnemar);
for (i = 0 ; i < t2s->n_pairs; ++i)
{
const struct cell *cell,
struct pivot_table *pt)
{
- size_t *indexes = xcalloc (pt->n_dimensions, sizeof *indexes);
+ size_t *indexes = XCALLOC (pt->n_dimensions, size_t);
for (int v = 0; v < mt->n_dep_vars; ++v)
{
for (int s = 0; s < means->n_statistics; ++s)
const bool n_sample_test = (value_compare_3way (&nst->val2, &nst->val1,
var_get_width (nst->indep_var)) > 0);
- struct results *results = xcalloc (nst->n_vars, sizeof (*results));
+ struct results *results = XCALLOC (nst->n_vars, struct results);
int n_vals = 0;
for (v = 0; v < nst->n_vars; ++v)
{
{
int i;
- struct roc_state *rs = xcalloc (roc->n_vars, sizeof *rs);
+ struct roc_state *rs = XCALLOC (roc->n_vars, struct roc_state);
struct casereader *negatives = NULL;
struct casereader *positives = NULL;
struct one_sample_test *otp = UP_CAST (test, struct one_sample_test, parent);
struct runs_test *rt = UP_CAST (otp, struct runs_test, parent);
- struct run_state *rs = xcalloc (otp->n_vars, sizeof (*rs));
+ struct run_state *rs = XCALLOC (otp->n_vars, struct run_state);
switch (rt->cp_mode)
{
const struct two_sample_test *t2s = UP_CAST (test, const struct two_sample_test, parent);
struct ccase *c;
- struct sign_test_params *stp = xcalloc (t2s->n_pairs, sizeof *stp);
+ struct sign_test_params *stp = XCALLOC (t2s->n_pairs, struct sign_test_params);
struct casereader *r = input;
struct ccase *c;
struct casereader *r;
- struct pair_stats *ps = xcalloc (tt->n_vars, sizeof *ps);
+ struct pair_stats *ps = XCALLOC (tt->n_vars, struct pair_stats);
int v;
const struct dictionary *dict = dataset_dict (ds);
const struct two_sample_test *t2s = UP_CAST (test, const struct two_sample_test, parent);
- struct wilcoxon_state *ws = xcalloc (t2s->n_pairs, sizeof *ws);
+ struct wilcoxon_state *ws = XCALLOC (t2s->n_pairs, struct wilcoxon_state);
const struct variable *weight = dict_get_weight (dict);
struct variable *weightx = dict_create_internal_var (WEIGHT_IDX, 0);
struct caseproto *proto;
static struct mc_results *
mc_results_create (void)
{
- struct mc_results *results = xcalloc (1, sizeof (struct mc_results));
+ struct mc_results *results = XCALLOC (1, struct mc_results);
results->stop_reason = MC_CONTINUING;
gettimeofday (&results->start, NULL);
return results;
return;
}
- struct value_node **nodes = xcalloc (n_vals, sizeof *nodes);
+ struct value_node **nodes = XCALLOC (n_vals, struct value_node *);
int x = 0;
struct value_node *valnd;
HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap)
out->b = in->color.b;
}
- struct footnote **footnotes = xcalloc (pt->n_footnotes, sizeof *footnotes);
+ struct footnote **footnotes = XCALLOC (pt->n_footnotes, struct footnote *);
for (size_t i = 0; i < pt->n_footnotes; i++)
{
const struct pivot_footnote *pf = pt->footnotes[i];
pt->show_values, pt->show_variables,
false, pt->rotate_outer_row_labels);
- size_t *dindexes = xcalloc (pt->n_dimensions, sizeof *dindexes);
+ size_t *dindexes = XCALLOC (pt->n_dimensions, size_t);
size_t y = 0;
PIVOT_ENUMERATION_FOR_EACH (pindexes[PIVOT_AXIS_ROW], row_enumeration,
&pt->axes[PIVOT_AXIS_ROW])
axis->n_dimensions), 1),
sizeof *enumeration);
size_t *p = enumeration;
- size_t *dindexes = xcalloc (table->n_dimensions, sizeof *dindexes);
+ size_t *dindexes = XCALLOC (table->n_dimensions, size_t);
size_t *axis_indexes;
PIVOT_AXIS_FOR_EACH (axis_indexes, axis)
pivot_dimension_dump (table->dimensions[i], indentation);
/* Presentation and data indexes. */
- size_t *dindexes = xcalloc (table->n_dimensions, sizeof *dindexes);
+ size_t *dindexes = XCALLOC (table->n_dimensions, size_t);
const struct pivot_axis *layer_axis = &table->axes[PIVOT_AXIS_LAYER];
if (layer_axis->n_dimensions)
goto error;
}
- out->sources = xcalloc (lb->n_sources, sizeof *out->sources);
+ out->sources = XCALLOC (lb->n_sources, struct spv_data_source);
out->n_sources = lb->n_sources;
for (size_t i = 0; i < lb->n_sources; i++)
return &BAD_REFERENCE;
n_values = existing_series->n_values;
- values = xcalloc (n_values, sizeof *values);
+ values = XCALLOC (n_values, struct spv_data_value);
for (size_t i = 0; i < n_values; i++)
values[i].width = -1;
}
{
/* Formatting for individual cells or groups of them with some dimensions
in common. */
- int **indexes = xcalloc (table->n_dimensions, sizeof *indexes);
- size_t *n = xcalloc (table->n_dimensions, sizeof *n);
- size_t *allocated = xcalloc (table->n_dimensions, sizeof *allocated);
+ int **indexes = XCALLOC (table->n_dimensions, int *);
+ size_t *n = XCALLOC (table->n_dimensions, size_t);
+ size_t *allocated = XCALLOC (table->n_dimensions, size_t);
for (size_t i = 0; i < intersect->n_where; i++)
{
struct pivot_dimension *dimension,
const char *encoding)
{
- category->subs = xcalloc (n_categories, sizeof *category->subs);
+ category->subs = XCALLOC (n_categories, struct pivot_category *);
category->n_subs = 0;
category->allocated_subs = 0;
category->show_label = show_label;
/* Allocate and fill the array of leaves now that we know how many there
are. */
- out->data_leaves = xcalloc (out->n_leaves, sizeof *out->data_leaves);
- out->presentation_leaves = xcalloc (out->n_leaves,
- sizeof *out->presentation_leaves);
+ out->data_leaves = XCALLOC (out->n_leaves, struct pivot_category *);
+ out->presentation_leaves = XCALLOC (out->n_leaves, struct pivot_category *);
out->allocated_leaves = out->n_leaves;
error = fill_leaves (out->root, out);
if (error)
enum pivot_axis_type axis_type, struct pivot_table *table)
{
struct pivot_axis *axis = &table->axes[axis_type];
- axis->dimensions = xcalloc (n_dimensions, sizeof *axis->dimensions);
+ axis->dimensions = XCALLOC (n_dimensions, struct pivot_dimension *);
axis->n_dimensions = n_dimensions;
axis->extent = 1;
for (size_t i = 0; i < n_dimensions; i++)
/* Dimensions. */
out->n_dimensions = in->dimensions->n_dims;
- out->dimensions = xcalloc (out->n_dimensions, sizeof *out->dimensions);
+ out->dimensions = XCALLOC (out->n_dimensions, struct pivot_dimension *);
for (size_t i = 0; i < out->n_dimensions; i++)
{
error = decode_spvlb_dimension (out, in->dimensions->dims[i],
int i;
- struct fmt_guesser **fg = xcalloc (n_vars, sizeof *fg);
+ struct fmt_guesser **fg = XCALLOC (n_vars, struct fmt_guesser *);
for (i = 0 ; i < n_vars; ++i)
{
fg[i] = fmt_guesser_create ();