casereader_create_arithmetic_sequence (struct casereader *subreader,
double first, double increment)
{
- struct arithmetic_sequence *as = xzalloc (sizeof *as);
+ struct arithmetic_sequence *as = XZALLOC (struct arithmetic_sequence);
as->first = first;
as->increment = increment;
return casereader_create_append_numeric (subreader, next_arithmetic,
struct dataset *
dataset_create (struct session *session, const char *name)
{
- struct dataset *ds;
-
- ds = xzalloc (sizeof *ds);
+ struct dataset *ds = XZALLOC (struct dataset);
ds->name = xstrdup (name);
ds->display = DATASET_FRONT;
ds->dict = dict_create (get_default_encoding ());
struct dictionary *
dict_create (const char *encoding)
{
- struct dictionary *d = xzalloc (sizeof *d);
+ struct dictionary *d = XZALLOC (struct dictionary);
d->encoding = xstrdup (encoding);
d->names_must_be_ids = true;
create_handle (const char *id, char *handle_name, enum fh_referent referent,
const char *encoding)
{
- struct file_handle *handle = xzalloc (sizeof *handle);
+ struct file_handle *handle = XZALLOC (struct file_handle);
handle->ref_cnt = 1;
handle->id = xstrdup_if_nonnull (id);
mdd_write (struct file_handle *fh, struct dictionary *dict,
const char *sav_name)
{
- struct mdd_writer *w = xzalloc (sizeof *w);
+ struct mdd_writer *w = XZALLOC (struct mdd_writer);
size_t n_vars = dict_get_var_cnt (dict);
/* Open file handle as an exclusive writer. */
r->rsd.node_type == XML_READER_TYPE_TEXT)
{
int col;
- struct xml_value *xmv = xzalloc (sizeof *xmv);
+ struct xml_value *xmv = XZALLOC (struct xml_value);
xmv->text = xmlTextReaderValue (r->rsd.xtr);
xmv->value = val_string;
val_string = NULL;
struct spreadsheet *
ods_probe (const char *filename, bool report_errors)
{
- struct ods_reader *r = xzalloc (sizeof *r);
+ struct ods_reader *r = XZALLOC (struct ods_reader);
struct zip_reader *zr;
char *error = zip_reader_create (filename, &zr);
static struct any_reader *
pcp_open (struct file_handle *fh)
{
- struct pcp_reader *r;
struct stat s;
/* Create and initialize reader. */
- r = xzalloc (sizeof *r);
+ struct pcp_reader *r = XZALLOC (struct pcp_reader);
r->any_reader.klass = &pcp_file_reader_class;
r->pool = pool_create ();
pool_register (r->pool, free, r);
casenumber n_cases = CASENUMBER_MAX;
const char *encoding;
- struct psql_reader *r = xzalloc (sizeof *r);
+ struct psql_reader *r = XZALLOC (struct psql_reader);
struct string query ;
r->conn = PQconnectdb (info->conninfo);
sfm_open (struct file_handle *fh)
{
size_t allocated_mrsets = 0;
- struct sfm_reader *r;
/* Create and initialize reader. */
- r = xzalloc (sizeof *r);
+ struct sfm_reader *r = XZALLOC (struct sfm_reader);
r->any_reader.klass = &sys_file_reader_class;
r->pool = pool_create ();
pool_register (r->pool, free, r);
struct sfm_write_options opts)
{
struct encoding_info encoding_info;
- struct sfm_writer *w;
mode_t mode;
int i;
}
/* Create and initialize writer. */
- w = xzalloc (sizeof *w);
+ struct sfm_writer *w = XZALLOC (struct sfm_writer);
w->fh = fh_ref (fh);
w->lock = NULL;
w->file = NULL;
struct variable *
var_create (const char *name, int width)
{
- struct variable *v;
enum val_type type;
assert (width >= 0 && width <= MAX_STRING);
- v = xzalloc (sizeof *v);
+ struct variable *v = XZALLOC (struct variable);
var_set_name_quiet (v, name);
v->width = width;
mv_init (&v->miss, width);
enum mrset_type type)
{
const char *subcommand_name = type == MRSET_MD ? "MDGROUP" : "MCGROUP";
- struct mrset *mrset;
bool labelsource_varlabel;
bool has_value;
- mrset = xzalloc (sizeof *mrset);
+ struct mrset *mrset = XZALLOC (struct mrset);
mrset->type = type;
mrset->cat_source = MRSET_VARLABELS;
variables. */
for (i = 0; i < n_dest; i++)
{
- struct agr_var *v = xzalloc (sizeof *v);
+ struct agr_var *v = XZALLOC (struct agr_var);
/* Add variable to chain. */
if (agr->agr_vars != NULL)
bool print = false;
/* Create procedure. */
- struct autorecode_pgm *arc = xzalloc (sizeof *arc);
+ struct autorecode_pgm *arc = XZALLOC (struct autorecode_pgm);
arc->blank_valid = true;
/* Parse variable lists. */
static struct idata *
idata_alloc (size_t n_vars)
{
- struct idata *id = xzalloc (sizeof (*id));
+ struct idata *id = XZALLOC (struct idata);
id->n_extractions = 0;
id->msr = gsl_vector_alloc (n_vars);
const struct workspace *ws)
{
int n_vars = count_one_bits (not_wild);
- struct cell *cell = xzalloc ((sizeof *cell));
+ struct cell *cell = XZALLOC (struct cell);
cell->values = xcalloc (n_vars, sizeof *cell->values);
cell->vars = xcalloc (n_vars, sizeof *cell->vars);
cell->not_wild = not_wild;
if (n_sample_test == false)
{
- struct val_node *vn = xzalloc (sizeof *vn);
+ struct val_node *vn = XZALLOC (struct val_node);
value_clone (&vn->val, &nst->val1, var_get_width (nst->indep_var));
hmap_insert (&map, &vn->node, value_hash (&nst->val1,
var_get_width (nst->indep_var), 0));
}
else if (lex_match_id (lexer, "CONTRAST"))
{
- struct contrasts_node *cl = xzalloc (sizeof *cl);
+ struct contrasts_node *cl = XZALLOC (struct contrasts_node);
struct ll_list *coefficient_list = &cl->coefficient_list;
lex_match (lexer, T_EQUALS);
struct argv_parser *
argv_parser_create (void)
{
- struct argv_parser *ap = xzalloc (sizeof *ap);
+ struct argv_parser *ap = XZALLOC (struct argv_parser);
return ap;
}
return NULL;
}
- struct zip_reader *zr = xzalloc (sizeof *zr);
+ struct zip_reader *zr = XZALLOC (struct zip_reader);
zr->ref_cnt = 1;
zr->file_name = xstrdup (file_name);
zr->entries = xcalloc (n_members, sizeof *zr->entries);
inflate_init (struct zip_member *zm)
{
int r;
- struct inflator *inf = xzalloc (sizeof *inf);
+ struct inflator *inf = XZALLOC (struct inflator);
uint16_t flg = 0 ;
uint16_t cmf = 0x8; /* Always 8 for inflate */
{
struct box_whisker *bw = UP_CAST (s, struct box_whisker, parent.parent);
bool extreme;
- struct outlier *o;
if (y > bw->hinges[2] + bw->step) /* Upper outlier */
{
/* y is an outlier */
- o = xzalloc (sizeof *o) ;
+ struct outlier *o = xzalloc (sizeof *o) ;
o->value = y;
o->extreme = extreme;
ds_init_empty (&o->label);
box_whisker_create (const struct tukey_hinges *th,
size_t id_idx, const struct variable *id_var)
{
- struct box_whisker *w = xzalloc (sizeof (*w));
+ struct box_whisker *w = XZALLOC (struct box_whisker);
struct order_stats *os = &w->parent;
struct statistic *stat = &os->parent;
categoricals_create (struct interaction *const *inter, size_t n_inter,
const struct variable *wv, enum mv_class fctr_excl)
{
- struct categoricals *cat = xzalloc (sizeof *cat);
+ struct categoricals *cat = XZALLOC (struct categoricals);
cat->iap = pool_calloc (cat->pool, n_inter, sizeof *cat->iap);
cat->n_iap = n_inter;
cat->wv = wv;
bool centered)
{
size_t i;
- struct covariance *cov = xzalloc (sizeof *cov);
+ struct covariance *cov = XZALLOC (struct covariance);
cov->centered = centered;
cov->passes = 1;
struct levene *
levene_create (int indep_width, const union value *cutpoint)
{
- struct levene *nl = xzalloc (sizeof *nl);
+ struct levene *nl = XZALLOC (struct levene);
hmap_init (&nl->hmap);
if (NULL == lev)
{
- struct lev *l = xzalloc (sizeof *l);
+ struct lev *l = XZALLOC (struct lev);
value_clone (&l->group, gv, nl->gvw);
hmap_insert (&nl->hmap, &l->node, nl->hash (nl, &l->group));
lev = l;
struct np *
np_create (double n, double mean, double var)
{
- struct np *np = xzalloc (sizeof (*np));
+ struct np *np = XZALLOC (struct np);
struct order_stats *os = &np->parent;
struct statistic *stat = &os->parent;
struct caseproto *proto;
struct percentile *
percentile_create (double p, double W)
{
- struct percentile *ptl = xzalloc (sizeof (*ptl));
+ struct percentile *ptl = XZALLOC (struct percentile);
struct order_stats *os = &ptl->parent;
struct statistic *stat = &os->parent;
if (n < 3 || n > 5000)
return NULL;
- struct shapiro_wilk *sw = xzalloc (sizeof (*sw));
+ struct shapiro_wilk *sw = XZALLOC (struct shapiro_wilk);
struct order_stats *os = &sw->parent;
struct statistic *stat = &os->parent;
struct trimmed_mean *
trimmed_mean_create (double W, double tail)
{
- struct trimmed_mean *tm = xzalloc (sizeof (*tm));
+ struct trimmed_mean *tm = XZALLOC (struct trimmed_mean);
struct order_stats *os = &tm->parent;
struct statistic *stat = &os->parent;
tukey_hinges_create (double W, double c_min)
{
double d;
- struct tukey_hinges *th = xzalloc (sizeof (*th));
+ struct tukey_hinges *th = XZALLOC (struct tukey_hinges);
struct order_stats *os = &th->parent;
struct statistic *stat = &os->parent;
{
enum { BOX_ASCII, BOX_UNICODE } box;
struct output_driver *d;
- struct ascii_driver *a;
-
- a = xzalloc (sizeof *a);
+ struct ascii_driver *a = XZALLOC (struct ascii_driver);
d = &a->driver;
output_driver_init (&a->driver, &ascii_driver_class, fh_get_file_name (fh), device_type);
a->append = parse_boolean (opt (d, o, "append", "false"));
xr_allocate (const char *name, int device_type,
enum xr_output_type output_type, struct string_map *o)
{
- struct xr_driver *xr = xzalloc (sizeof *xr);
+ struct xr_driver *xr = XZALLOC (struct xr_driver);
struct output_driver *d = &xr->driver;
output_driver_init (d, &cairo_driver_class, name, device_type);
const char *ylabel, bool percent,
struct freq *const *cats, int n_cats)
{
- struct barchart *bar;
int i;
const int pidx = 0;
assert (n_vars >= 1 && n_vars <= 2);
- bar = xzalloc (sizeof *bar);
+ struct barchart *bar = XZALLOC (struct barchart);
bar->percent = percent;
bar->var = var;
bar->n_vars = n_vars;
if (!flag)
{
- struct category *s = xzalloc (sizeof *s);
+ struct category *s = XZALLOC (struct category);
s->idx = idx++;
s->width = var_get_width (var[pidx]);
value_init (&s->val, s->width);
if (!flag)
{
- struct category *s = xzalloc (sizeof *s);
+ struct category *s = XZALLOC (struct category);
s->idx = idx++;
s->width = var_get_width (var[sidx]);
value_init (&s->val, s->width);
make_np_plot (const struct np *np, const struct casereader *reader,
const char *label, bool detrended)
{
- struct np_plot_chart *npp;
-
if (np->n <= 1.0)
return NULL;
- npp = xzalloc (sizeof *npp);
+ struct np_plot_chart *npp = XZALLOC (struct np_plot_chart);
chart_init (&npp->chart, &np_plot_chart_class, label);
npp->data = casereader_clone (reader);
npp->y_min = np->y_min;
const char *label,
double xmin, double xmax, double ymin, double ymax)
{
- struct scatterplot_chart *spc;
-
- spc = xzalloc (sizeof *spc);
+ struct scatterplot_chart *spc = XZALLOC (struct scatterplot_chart);
chart_init (&spc->chart, &scatterplot_chart_class, label);
spc->data = reader;
struct chart *
spreadlevel_plot_create (const char *label, double tx_pwr)
{
- struct spreadlevel_plot_chart *sl = xzalloc (sizeof *sl);
+ struct spreadlevel_plot_chart *sl = XZALLOC (struct spreadlevel_plot_chart);
chart_init (&sl->chart, &spreadlevel_plot_chart_class, label);
sl->x_lower = DBL_MAX;
struct string_map *o)
{
struct output_driver *d;
- struct csv_driver *csv;
char *quote;
- csv = xzalloc (sizeof *csv);
+ struct csv_driver *csv = XZALLOC (struct csv_driver);
d = &csv->driver;
output_driver_init (&csv->driver, &csv_driver_class, fh_get_file_name (fh), device_type);
void
output_engine_push (void)
{
- struct output_engine *e = xzalloc (sizeof (*e));
+ struct output_engine *e = XZALLOC (struct output_engine);
llx_init (&e->drivers);
struct string_map *o)
{
struct output_driver *d;
- struct html_driver *html;
-
- html = xzalloc (sizeof *html);
+ struct html_driver *html = XZALLOC (struct html_driver);
d = &html->driver;
output_driver_init (&html->driver, &html_driver_class, fh_get_file_name (fh),
device_type);
msglog_create (const char *file_name)
{
enum settings_output_devices type;
- struct msglog_driver *ml;
FILE *file;
struct file_handle *handle = fh_create_file (NULL, file_name, NULL, fh_default_properties ());
? SETTINGS_DEVICE_TERMINAL
: SETTINGS_DEVICE_UNFILTERED);
- ml = xzalloc (sizeof *ml);
+ struct msglog_driver *ml = XZALLOC (struct msglog_driver);
ml->handle = handle;
output_driver_init (&ml->driver, &msglog_class, file_name, type);
ml->file = file;
struct string_map *o UNUSED)
{
struct output_driver *d;
- struct odt_driver *odt;
struct zip_writer *zip;
const char *file_name = fh_get_file_name (fh);
if (zip == NULL)
return NULL;
- odt = xzalloc (sizeof *odt);
+ struct odt_driver *odt = XZALLOC (struct odt_driver);
d = &odt->driver;
output_driver_init (d, &odt_driver_class, file_name, device_type);
ex->font_style->typeface = xstrdup ("Monospaced");
}
- struct output_item *item = xzalloc (sizeof *item);
+ struct output_item *item = XZALLOC (struct output_item);
*item = (struct output_item) {
OUTPUT_ITEM_INITIALIZER (OUTPUT_ITEM_TEXT),
.command_name = xstrdup_if_nonnull (output_get_command_name ()),
struct pivot_table *
pivot_table_create__ (struct pivot_value *title, const char *subtype)
{
- struct pivot_table *table = xzalloc (sizeof *table);
+ struct pivot_table *table = XZALLOC (struct pivot_table);
table->ref_cnt = 1;
table->show_title = true;
table->show_caption = true;
pivot_value_new_value (const union value *value, int width,
const struct fmt_spec *format, const char *encoding)
{
- struct pivot_value *pv = xzalloc (sizeof *pv);
+ struct pivot_value *pv = XZALLOC (struct pivot_value);
if (width > 0)
{
char *s = recode_string (UTF8, encoding, CHAR_CAST (char *, value->s),
insert_overflow (struct render_page_selection *s,
const struct table_cell *cell)
{
- struct render_overflow *of = xzalloc (sizeof *of);
+ struct render_overflow *of = XZALLOC (struct render_overflow);
cell_to_subpage (s, cell, of->d);
hmap_insert (&s->subpage->overflows, &of->node,
hash_cell (of->d[H], of->d[V]));
struct string_map *o UNUSED)
{
struct output_driver *d;
- struct spv_driver *spv;
-
- spv = xzalloc (sizeof *spv);
+ struct spv_driver *spv = XZALLOC (struct spv_driver);
d = &spv->driver;
spv->handle = fh;
output_driver_init (&spv->driver, &spv_driver_class, fh_get_file_name (fh),
if (target)
{
- struct pivot_value *value = xzalloc (sizeof *value);
+ struct pivot_value *value = XZALLOC (struct pivot_value);
value->type = PIVOT_VALUE_TEXT;
for (size_t i = 0; i < lf->label->n_text; i++)
{
"source %s variable %s.",
sv->node_.id, sv->source, sv->source_name);
- struct spv_series *s = xzalloc (sizeof *s);
+ struct spv_series *s = XZALLOC (struct spv_series);
s->name = xstrdup (node->id);
s->xml = node;
s->label = xstrdup_if_nonnull (sv->label);
return xasprintf ("Derived variable %s has unknown value \"%s\"",
node->id, dv->value);
- struct spv_series *s = xzalloc (sizeof *s);
+ struct spv_series *s = XZALLOC (struct spv_series);
s->format = F_8_0;
s->name = xstrdup (node->id);
s->values = values;
if (error)
return error;
- struct pivot_value *v = xzalloc (sizeof *v);
+ struct pivot_value *v = XZALLOC (struct pivot_value);
if (data->width >= 0)
{
if (format && fmt_get_category (f.type) == FMT_CAT_DATE)
assert (n_cats > 0);
/* Make the categories. */
- struct pivot_dimension *d = xzalloc (sizeof *d);
+ struct pivot_dimension *d = XZALLOC (struct pivot_dimension);
table->dimensions[table->n_dimensions++] = d;
series[0]->n_index = max_cat + 1;
{
struct spv_data_value *dv = &series[0]->values[cat_rows[k]];
int dv_num = dv ? dv->d : dv->index;
- struct pivot_category *cat = xzalloc (sizeof *cat);
+ struct pivot_category *cat = XZALLOC (struct pivot_category);
char *retval = pivot_value_from_data_value (
spv_map_lookup (&series[0]->map, dv), NULL, NULL, &cat->name);
if (retval)
{
*outp = NULL;
- struct pivot_value *out = xzalloc (sizeof *out);
+ struct pivot_value *out = XZALLOC (struct pivot_value);
const struct spvlb_value_mod *vm;
char *error;
if (error)
return error;
- struct pivot_category *out = xzalloc (sizeof *out);
+ struct pivot_category *out = XZALLOC (struct pivot_category);
out->name = name;
out->parent = parent;
out->dimension = dimension;
if (error)
return error;
- struct pivot_dimension *out = xzalloc (sizeof *out);
+ struct pivot_dimension *out = XZALLOC (struct pivot_dimension);
out->level = UINT_MAX;
out->top_index = idx;
out->hide_all_labels = in->props->hide_all_labels;
in->header->version);
char *error = NULL;
- struct pivot_table *out = xzalloc (sizeof *out);
+ struct pivot_table *out = XZALLOC (struct pivot_table);
out->ref_cnt = 1;
hmap_init (&out->cells);
out->look = pivot_table_look_new_builtin_default ();
static struct comparator *
numeric_comparator_create (const struct variable *var, const char *target)
{
- struct numeric_comparator *nc = xzalloc (sizeof (*nc));
+ struct numeric_comparator *nc = XZALLOC (struct numeric_comparator);
struct comparator *cmptr = &nc->parent;
cmptr->flags = 0;
string_comparator_create (const struct variable *var, const char *target,
enum string_cmp_flags flags)
{
- struct string_comparator *ssc = xzalloc (sizeof (*ssc));
+ struct string_comparator *ssc = XZALLOC (struct string_comparator);
struct comparator *cmptr = &ssc->parent;
cmptr->flags = flags;
enum string_cmp_flags flags)
{
int code;
- struct regexp_comparator *rec = xzalloc (sizeof (*rec));
+ struct regexp_comparator *rec = XZALLOC (struct regexp_comparator);
struct comparator *cmptr = &rec->parent;
cmptr->flags = flags;
if (cn == NULL)
{
- struct separator_count_node *new_cn = xzalloc (sizeof *new_cn);
+ struct separator_count_node *new_cn = XZALLOC (struct separator_count_node);
new_cn->occurance = counts[j];
new_cn->quantity = 1;
hmap_insert (&count_map[j], &new_cn->node, hash);
void
psppire_output_window_setup (void)
{
- struct psppire_output_driver *pod;
+ struct psppire_output_driver *pod = XZALLOC (struct psppire_output_driver);
struct output_driver *d;
- pod = xzalloc (sizeof *pod);
d = &pod->driver;
output_driver_init (d, &psppire_output_class, "PSPPIRE",
SETTINGS_DEVICE_UNFILTERED);
enum segmenter_mode *syntax_mode, bool *process_statrc,
char **syntax_encoding)
{
- struct terminal_opts *to;
-
*syntax_mode = SEG_MODE_AUTO;
*process_statrc = true;
*syntax_encoding = "Auto";
- to = xzalloc (sizeof *to);
+ struct terminal_opts *to = XZALLOC (struct terminal_opts);
to->syntax_mode = syntax_mode;
string_map_init (&to->options);
to->has_output_driver = false;
struct lex_reader *
terminal_reader_create (void)
{
- struct terminal_reader *r;
-
if (!n_terminal_readers++)
readline_init ();
- r = xzalloc (sizeof *r);
+ struct terminal_reader *r = XZALLOC (struct terminal_reader);
r->reader.class = &terminal_reader_class;
r->reader.syntax = SEG_MODE_INTERACTIVE;
r->reader.error = LEX_ERROR_TERMINAL;