.cells = -1,
};
- bool *taken_vars = xzalloc (n_input_vars);
+ bool *taken_vars = XCALLOC (n_input_vars, bool);
if (input_rowtype)
taken_vars[var_get_dict_index (rowtype)] = true;
struct one_sample_test *ost = &cst->parent;
double total_expected = 0.0;
- double *df = xzalloc (sizeof (*df) * ost->n_vars);
- double *xsq = xzalloc (sizeof (*df) * ost->n_vars);
+ double *df = XCALLOC (ost->n_vars, double);
+ double *xsq = XCALLOC (ost->n_vars, double);
bool ok;
for (i = 0 ; i < cst->n_expected ; ++i)
}
}
- int *by_iter = xcalloc (n_by, sizeof *by_iter);
+ int *by_iter = XCALLOC (n_by, int);
proc->pivots = xnrealloc (proc->pivots,
proc->n_pivots + nx, sizeof *proc->pivots);
for (int i = 0; i < nx; i++)
if (proc->barchart)
{
int n_vars = (xt->n_vars > 2 ? 2 : xt->n_vars);
- const struct variable **vars = xcalloc (n_vars, sizeof *vars);
+ const struct variable **vars = XCALLOC (n_vars, const struct variable*);
for (size_t i = 0; i < n_vars; i++)
vars[i] = xt->vars[i].var;
chart_submit (barchart_create (vars, n_vars, _("Count"),
{
const int n_os = 5 + examine->n_percentiles;
- struct order_stats **os ;
es[v].percentiles = pool_calloc (examine->pool, examine->n_percentiles, sizeof (*es[v].percentiles));
es[v].trimmed_mean = trimmed_mean_create (es[v].cc, 0.05);
es[v].shapiro_wilk = NULL;
- os = xcalloc (n_os, sizeof *os);
+ struct order_stats **os = XCALLOC (n_os, struct order_stats *);
os[0] = &es[v].trimmed_mean->parent;
es[v].quartiles[0] = percentile_create (0.25, es[v].cc);
if (percentiles_seen && examine.n_percentiles == 0)
{
examine.n_percentiles = 7;
- examine.ptiles = xcalloc (examine.n_percentiles,
- sizeof (*examine.ptiles));
+ examine.ptiles = xcalloc (examine.n_percentiles, sizeof (*examine.ptiles));
examine.ptiles[0] = 5;
examine.ptiles[1] = 10;
PV_NO_DUPLICATE))
goto error;
- frq.vars = xzalloc (frq.n_vars * sizeof (*frq.vars));
+ frq.vars = xcalloc (frq.n_vars, sizeof (*frq.vars));
for (i = 0; i < frq.n_vars; ++i)
{
frq.vars[i].var = vars[i];
if (!lex_force_match (lexer, T_LPAREN))
goto error;
- graph->dep_vars = xzalloc (sizeof (graph->dep_vars) * graph->n_dep_vars);
+ graph->dep_vars = xcalloc (graph->n_dep_vars, sizeof (graph->dep_vars));
for (v = 0; v < ag_func[i].arity; ++v)
{
graph->dep_vars[v] = parse_variable (lexer, graph->dict);
{
struct workspace *ws = mt->ws + i;
ws->root_cell = NULL;
- ws->control_idx = xzalloc (mt->n_layers
- * sizeof *ws->control_idx);
- ws->instances = xzalloc (mt->n_layers
- * sizeof *ws->instances);
+ ws->control_idx = xcalloc (mt->n_layers, sizeof *ws->control_idx);
+ ws->instances = xcalloc (mt->n_layers, sizeof *ws->instances);
int cmb = i;
for (int l = mt->n_layers - 1; l >= 0; --l)
{
for (int t = 0; t < means.n_tables; ++t)
{
struct mtable *mt = means.table + t;
- mt->summ = xzalloc (mt->n_combinations * mt->n_dep_vars
- * sizeof (*mt->summ));
- mt->ws = xzalloc (mt->n_combinations * sizeof (*mt->ws));
+ mt->summ = xcalloc (mt->n_combinations * mt->n_dep_vars,
+ sizeof (*mt->summ));
+ mt->ws = xcalloc (mt->n_combinations, sizeof (*mt->ws));
}
run_means (&means, group, ds);
for (int t = 0; t < means.n_tables; ++t)
}
results[v].n = count;
- results[v].sorted_array = xcalloc (hmap_count (&map), sizeof (void*));
+ results[v].sorted_array = XCALLOC (hmap_count (&map), void*);
results[v].var = var;
HMAP_FOR_EACH (vn, struct val_node, node, &map)
struct oneway_workspace ws;
ws.actual_number_of_groups = 0;
- ws.vws = xzalloc (cmd->n_vars * sizeof (*ws.vws));
- ws.dd_total = xmalloc (sizeof (struct descriptive_data) * cmd->n_vars);
+ ws.vws = xcalloc (cmd->n_vars, sizeof (*ws.vws));
+ ws.dd_total = XCALLOC (cmd->n_vars, struct descriptive_data*);
for (v = 0 ; v < cmd->n_vars; ++v)
ws.dd_total[v] = dd_create (cmd->vars[v]);
bool output)
{
size_t i;
- struct linreg **models = NULL;
- struct model_container *model_container = xzalloc (sizeof (*model_container) * cmd->n_vars);
+ struct model_container *model_container = XCALLOC (cmd->n_vars, struct model_container);
struct ccase *c;
struct covariance *cov;
casereader_destroy (r);
}
- models = xcalloc (cmd->n_dep_vars, sizeof (*models));
+ struct linreg **models = XCALLOC (cmd->n_dep_vars, struct linreg*);
for (int k = 0; k < cmd->n_dep_vars; k++)
{
/* Create a default Scale */
reliability.n_sc = 1;
- reliability.sc = xzalloc (sizeof (struct cronbach) * reliability.n_sc);
+ reliability.sc = xcalloc (reliability.n_sc, sizeof (struct cronbach));
ds_assign_cstr (&reliability.scale_name, "ANY");
c = &reliability.sc[0];
c->n_items = reliability.n_variables;
- c->items = xzalloc (sizeof (struct variable*) * c->n_items);
+ c->items = xcalloc (c->n_items, sizeof (struct variable*));
for (i = 0 ; i < c->n_items ; ++i)
c->items[i] = reliability.variables[i];
(reliability.split_point == -1) ? s->n_items / 2 : reliability.split_point;
reliability.sc[2].n_items = s->n_items - reliability.sc[1].n_items;
- reliability.sc[1].items = xzalloc (sizeof (struct variable *)
- * reliability.sc[1].n_items);
-
- reliability.sc[2].items = xzalloc (sizeof (struct variable *) *
- reliability.sc[2].n_items);
+ reliability.sc[1].items = XCALLOC (reliability.sc[1].n_items, const struct variable *);
+ reliability.sc[2].items = XCALLOC (reliability.sc[2].n_items, const struct variable *);
for (i = 0; i < reliability.sc[1].n_items ; ++i)
reliability.sc[1].items[i] = s->items[i];
struct cronbach *s = &reliability.sc[i + base_sc];
s->n_items = reliability.sc[0].n_items - 1;
- s->items = xzalloc (sizeof (struct variable *) * s->n_items);
+ s->items = xcalloc (s->n_items, sizeof (struct variable *));
for (v_src = 0 ; v_src < reliability.sc[0].n_items ; ++v_src)
{
if (v_src != i)
struct cronbach *s = &reliability->sc[si];
int i;
- s->m = xzalloc (sizeof *s->m * s->n_items);
+ s->m = xcalloc (s->n_items, sizeof *s->m);
s->total = moments1_create (MOMENT_VARIANCE);
for (i = 0 ; i < s->n_items ; ++i)
unsigned long int *
bitvector_allocate(size_t n)
{
- return xcalloc (DIV_RND_UP (n, BITS_PER_ULONG),
- sizeof (unsigned long int));
+ return XCALLOC (DIV_RND_UP (n, BITS_PER_ULONG), unsigned long int);
}
size_t
/* y is an outlier */
- struct outlier *o = xzalloc (sizeof *o) ;
+ struct outlier *o = XZALLOC (struct outlier);
o->value = y;
o->extreme = extreme;
ds_init_empty (&o->label);
and using int will save some memory on 64-bit systems. */
unsigned long int total;
unsigned long int max;
- int *array;
assert (w >= 0);
assert (n < CHAR_BIT * sizeof (unsigned long int));
else if (n == 1)
return 1;
- array = xcalloc (w + 1, sizeof *array);
+ int *array = XCALLOC (w + 1, int);
array[w] = 1;
max = w;
|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|
+-----+-----+-----+-----+-----+-----+-----+-----+-----+
*/
- bool *vrules = xzalloc (n_columns + 1);
+ bool *vrules = XCALLOC (n_columns + 1, bool);
vrules[0] = vrules[n_columns] = true;
for (int dim_index = h_axis->n_dimensions; --dim_index >= 0; )
{
return NULL;
}
- bool *refs = xzalloc (pt->n_footnotes);
+ bool *refs = XCALLOC (pt->n_footnotes, bool);
size_t n_refs = 0;
add_references (pt, title, refs, &n_refs);
add_references (pt, layers, refs, &n_refs);
.extra_depth = old->extra_depth,
.subs = (old->n_subs
- ? xzalloc (old->n_subs * sizeof *new->subs)
+ ? xcalloc (old->n_subs, sizeof *new->subs)
: NULL),
.n_subs = old->n_subs,
.allocated_subs = old->n_subs,
.axis_type = old->axis_type,
.level = old->level,
.top_index = old->top_index,
- .data_leaves = xzalloc (old->n_leaves * sizeof *new->data_leaves),
- .presentation_leaves = xzalloc (old->n_leaves
- * sizeof *new->presentation_leaves),
+ .data_leaves = xcalloc (old->n_leaves , sizeof *new->data_leaves),
+ .presentation_leaves = xcalloc (old->n_leaves
+ , sizeof *new->presentation_leaves),
.n_leaves = old->n_leaves,
.allocated_leaves = old->n_leaves,
.hide_all_labels = old->hide_all_labels,
for (int i = 0; i < TABLE_N_AXES; i++)
{
- page->cp[i] = xmalloc ((2 * n[i] + 2) * sizeof *page->cp[i]);
- page->join_crossing[i] = xzalloc ((n[i] + 1)
- * sizeof *page->join_crossing[i]);
+ page->cp[i] = xcalloc ((2 * n[i] + 2) , sizeof *page->cp[i]);
+ page->join_crossing[i] = xcalloc ((n[i] + 1) , sizeof *page->join_crossing[i]);
}
hmap_init (&page->overflows);
span multiple columns. */
struct render_row *columns[2];
for (int i = 0; i < 2; i++)
- columns[i] = xzalloc (nc * sizeof *columns[i]);
+ columns[i] = xcalloc (nc , sizeof *columns[i]);
for (int y = 0; y < nr; y++)
for (int x = 0; x < nc;)
{
}
/* Calculate heights of cells that do not span multiple rows. */
- struct render_row *rows = xzalloc (nr * sizeof *rows);
+ struct render_row *rows = XCALLOC (nr, struct render_row);
for (int y = 0; y < nr; y++)
for (int x = 0; x < nc;)
{
gchar *line_text = NULL;
gtk_tree_model_get (GTK_TREE_MODEL (ia->text_file), &iter, 1, &line_text, -1);
- gint *counts = xzalloc (sizeof *counts * SEPARATOR_CNT);
+ gint *counts = XCALLOC (SEPARATOR_CNT, gint);
struct substring cs = ss_cstr (line_text);
for (;
char_directives d;
arguments a;
GString *output;
- GtkWidget **widgets;
gchar *text;
va_list ap;
const char *s = fmt;
if (0 != printf_parse (fmt, &d, &a))
return NULL;
- widgets = xcalloc (d.count, sizeof (*widgets));
+ GtkWidget **widgets = XCALLOC (d.count, GtkWidget*);
va_start (ap, fmt);
for (i = 0 ; i < d.count ; ++i)
{