Replace numerous instances of xzalloc with XZALLOC
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 2 Oct 2021 04:47:31 +0000 (06:47 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 2 Oct 2021 04:48:25 +0000 (06:48 +0200)
51 files changed:
src/data/casereader-translator.c
src/data/dataset.c
src/data/dictionary.c
src/data/file-handle-def.c
src/data/mdd-writer.c
src/data/ods-reader.c
src/data/pc+-file-reader.c
src/data/psql-reader.c
src/data/sys-file-reader.c
src/data/sys-file-writer.c
src/data/variable.c
src/language/dictionary/mrsets.c
src/language/stats/aggregate.c
src/language/stats/autorecode.c
src/language/stats/factor.c
src/language/stats/means.c
src/language/stats/median.c
src/language/stats/oneway.c
src/libpspp/argv-parser.c
src/libpspp/zip-reader.c
src/math/box-whisker.c
src/math/categoricals.c
src/math/covariance.c
src/math/levene.c
src/math/np.c
src/math/percentiles.c
src/math/shapiro-wilk.c
src/math/trimmed-mean.c
src/math/tukey-hinges.c
src/output/ascii.c
src/output/cairo.c
src/output/charts/barchart.c
src/output/charts/np-plot.c
src/output/charts/scatterplot.c
src/output/charts/spreadlevel-plot.c
src/output/csv.c
src/output/driver.c
src/output/html.c
src/output/msglog.c
src/output/odt.c
src/output/output-item.c
src/output/pivot-table.c
src/output/render.c
src/output/spv-driver.c
src/output/spv/spv-legacy-decoder.c
src/output/spv/spv-light-decoder.c
src/ui/gui/find-dialog.c
src/ui/gui/psppire-import-textfile.c
src/ui/gui/psppire-output-window.c
src/ui/terminal/terminal-opts.c
src/ui/terminal/terminal-reader.c

index 3567f5c3a569b82bb1b5bff06e4b2a9146121957..831077466b0fd373a60f38928e3e4fe388aedc1e 100644 (file)
@@ -309,7 +309,7 @@ struct casereader *
 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,
index f966b63af96ab807d6c927d3a34f8053210b99fe..10005e0aca67968a72c12a45d4042104fc9ff327 100644 (file)
@@ -143,9 +143,7 @@ dataset_create_finish__ (struct dataset *ds, struct session *session)
 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 ());
index 9c73e0ea442229bbaa25ad1181ab5d405812e31d..ab4642a4da493c536b499a60e71479cbb14f7670 100644 (file)
@@ -250,7 +250,7 @@ dict_copy_callbacks (struct dictionary *dest,
 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;
index 075f7b07901c79150e84b1b27014ca7202270d53..de09ae39a75566b664995442667fcf73757b43f6 100644 (file)
@@ -221,7 +221,7 @@ static struct file_handle *
 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);
index 5e5eaa743dc0b639715329ee00d3c76185b38eed..10728e8cbdf988b0181990b0338808465b8a0005 100644 (file)
@@ -448,7 +448,7 @@ bool
 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. */
index b014a748d7bda81df41ddfd421c8172406133542..2ff12fe109f8b0a5117adf2e0638c03153957a61 100644 (file)
@@ -1079,7 +1079,7 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_)
           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;
@@ -1163,7 +1163,7 @@ init_reader (struct ods_reader *r, bool report_errors,
 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);
index 8b945788a5b8921ee7bcf10dbdb5d69a53eb5f1e..4753881a67a99e3a68fe059caf1760e52c817a42 100644 (file)
@@ -190,11 +190,10 @@ static bool parse_variable_records (struct pcp_reader *, struct dictionary *,
 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);
index 6780138b08da038015f0022ef81b59e606a2e2ce..a38c9e90301646a3329a0ef9f804fc9f3752a29f 100644 (file)
@@ -233,7 +233,7 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict)
   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);
index f11480ac8f76c6bc2a3c72ac6a33519bbe971e48..109b0dd16efd0d980a5a0e16225ae77a57e3650d 100644 (file)
@@ -391,10 +391,9 @@ static struct any_reader *
 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);
index 7a0fb5a691280ca3e4c542c1dbc3a9ebc09e92c3..54282a95f313831dde81df976d8eae2df7ad19e4 100644 (file)
@@ -200,7 +200,6 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d,
                  struct sfm_write_options opts)
 {
   struct encoding_info encoding_info;
-  struct sfm_writer *w;
   mode_t mode;
   int i;
 
@@ -213,7 +212,7 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d,
     }
 
   /* 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;
index 4859b1303faa3b31e737909c18003b59bbb81fd7..3f32fa5d02b8206b6308db9687475f3a796ed74d 100644 (file)
@@ -128,12 +128,11 @@ static void var_set_name_quiet (struct variable *v, const char *name);
 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);
index 5f544766e163703dd2f886c648328df021cd7527..3b96da3a6ceab28a7177416386bcef1d22ca87fa 100644 (file)
@@ -79,11 +79,10 @@ parse_group (struct lexer *lexer, struct dictionary *dict,
              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;
 
index 565e26d93808b4b8b92037c2a348375f0a3c12c3..86e11e07d772e24a81e4a32849d645ae1491655d 100644 (file)
@@ -565,7 +565,7 @@ parse_aggregate_functions (struct lexer *lexer, const struct dictionary *dict,
          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)
index 6481a263268f84fc43fe8cb000e23230a51038b5..1a74b1e4a9e4e3365e5fc77ca0fcbeb05147a654 100644 (file)
@@ -132,7 +132,7 @@ cmd_autorecode (struct lexer *lexer, struct dataset *ds)
   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. */
index 4feece0da0b813018f63a36a3eb947f7214b0723..8a5efac14b020d3c38645047224e82086664ea99 100644 (file)
@@ -250,7 +250,7 @@ struct idata
 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);
index 2235433fb92021600e4d380f2003135a6ab78053..0a3b413df721e7c8ef1f6114a358d1dcc523c885 100644 (file)
@@ -300,7 +300,7 @@ generate_cell (const struct means *means,
               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;
index 9c35c15a456aa54820a3faafaa847e5bbbcd3136..8fa38c5a692134506e5c71ff67255ee2c487378d 100644 (file)
@@ -134,7 +134,7 @@ median_execute (const struct dataset *ds,
 
       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));
index 2f1f299839c64536afa87d590516168d7bcbf03c..a61286255674fede14891abce111cd640c2970d5 100644 (file)
@@ -526,7 +526,7 @@ cmd_oneway (struct lexer *lexer, struct dataset *ds)
        }
       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);
index 97ec02834a43d02baf4598c9b5c05d8832960c8b..48c89cd6d44e93f6bb69f99a41bd6a98024c54af 100644 (file)
@@ -43,7 +43,7 @@ struct argv_parser
 struct argv_parser *
 argv_parser_create (void)
 {
-  struct argv_parser *ap = xzalloc (sizeof *ap);
+  struct argv_parser *ap = XZALLOC (struct argv_parser);
   return ap;
 }
 
index d33e5f930e289b4e86674548816f2834b3cfa376..00249e0bae41be64128720410c0079c7e819a230 100644 (file)
@@ -378,7 +378,7 @@ zip_reader_create (const char *file_name, struct zip_reader **zrp)
       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);
@@ -668,7 +668,7 @@ static char *
 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 */
index 344561a6fd24a0cdcd694778ba06733932427309..4bbe0f58505d1c60ef407417f0eb53d5b31cdf90 100644 (file)
@@ -61,7 +61,6 @@ acc (struct statistic *s, const struct ccase *cx,
 {
   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 */
     {
@@ -86,7 +85,7 @@ acc (struct statistic *s, const struct ccase *cx,
 
   /* 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);
@@ -145,7 +144,7 @@ struct box_whisker *
 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;
 
index 28d51a9dd704f5bc3a8937b496f05ac0e9cda94c..83326c3f006789814c4930feed8d85d15db95155 100644 (file)
@@ -323,7 +323,7 @@ struct categoricals *
 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;
index dec5ee87ccb86e1db1b507847c64bc4f6f2aa820..67a9fe9f219bf843d7f7ad7ea484851cbf8350b0 100644 (file)
@@ -145,7 +145,7 @@ covariance_1pass_create (size_t n_vars, const struct variable *const *vars,
                         bool centered)
 {
   size_t i;
-  struct covariance *cov = xzalloc (sizeof *cov);
+  struct covariance *cov = XZALLOC (struct covariance);
 
   cov->centered = centered;
   cov->passes = 1;
index 5785623a6ab0fd519d2a7d8105833f2528c71b8d..a005c9436091ecd58b992b936be5e74312a405bd 100644 (file)
@@ -118,7 +118,7 @@ find_group (const struct levene *nl, const union value *target)
 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);
 
@@ -146,7 +146,7 @@ levene_pass_one (struct levene *nl, double value, double weight, const union val
 
   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;
index 8b7d09e7d378a0639765801e55cbece47f116455..0d691c2aa7b6699a82cd174bedb77984e43a2ae0 100644 (file)
@@ -74,7 +74,7 @@ acc (struct statistic *s, const struct ccase *cx UNUSED,
 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;
index a387d3d4c270b1685984b6758e899f98f239a5f6..2d779e5bea3408ac17c872ff56b0861c500f03d6 100644 (file)
@@ -152,7 +152,7 @@ destroy (struct statistic *stat)
 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;
 
index 30feb39d9ddfb94cb9f844ae5f78444657a54126..6d10722297ab5eb4d0726ae385b08e0e081c8cbf 100644 (file)
@@ -119,7 +119,7 @@ shapiro_wilk_create (int n, double mean)
   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;
 
index d75b539a6692cb1c1ab5e299ab6538cf6968811d..b643651a26aa4240e0340768b32af1c3ed37a320 100644 (file)
@@ -52,7 +52,7 @@ destroy (struct statistic *s)
 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;
 
index c483a508c56eff590d4b35e6ac58bf8fb8d4b558..aaf4881afa954e79e2a9b731188572072df1b558 100644 (file)
@@ -74,7 +74,7 @@ struct tukey_hinges *
 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;
 
index f0be586dbd9277b69cee4af01471d2906c57c3ef..a6bcb106d68effd619d93ebdb559cac0dd06f09e 100644 (file)
@@ -370,9 +370,7 @@ ascii_create (struct  file_handle *fh, enum settings_output_devices device_type,
 {
   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"));
index dc5cf94ca3cbf1115835b68d19bcd4993c4cce78..a08771bb449ae68cb2d0d126c3c439a0e2907395 100644 (file)
@@ -187,7 +187,7 @@ static struct xr_driver *
 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);
index f9877940043259697b3c6903bd8fa1fa91d32f43..1b946fddffb780a0cd636eb8b3ff15742f4153f3 100644 (file)
@@ -175,7 +175,6 @@ barchart_create (const struct variable **var, int n_vars,
                 const char *ylabel, bool percent,
                 struct freq *const *cats, int n_cats)
 {
-  struct barchart *bar;
   int i;
 
   const int pidx = 0;
@@ -186,7 +185,7 @@ barchart_create (const struct variable **var, int n_vars,
 
   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;
@@ -222,7 +221,7 @@ barchart_create (const struct variable **var, int 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);
@@ -260,7 +259,7 @@ barchart_create (const struct variable **var, int 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[sidx]);
              value_init (&s->val, s->width);
index b0235924f8a471468be736b0d4fdee281e8f4e69..eeffbc1fa1d5f0cf3beae266974f1f95dd89bd25 100644 (file)
@@ -31,12 +31,10 @@ static struct chart *
 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;
index 9c9c42a71ebf0fd06b22e3a451e4befc9e78ddaa..5e8d27155e72606d850d979dfec12bb91c73c1a7 100644 (file)
@@ -37,9 +37,7 @@ scatterplot_create (struct casereader *reader,
                    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;
 
index 5fd189d6e06c2f2fc8fb3cd75959f7fd857ce246..2d15e5430ec7871463e26603cec201aad64979ab 100644 (file)
@@ -31,7 +31,7 @@
 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;
index b1ad6b0c172b48687f6122721eb5cf291073b836..ba1481c9a0c44caf9ab2de9873b67aa2f49dd604 100644 (file)
@@ -77,10 +77,9 @@ csv_create (struct file_handle *fh, enum settings_output_devices device_type,
             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);
 
index f40876449b9ef473121a7075a656fca171a8188b..063ae9366bf119697c97f9da780b85d68649c279 100644 (file)
@@ -91,7 +91,7 @@ put_strftime (const char *key, const char *format,
 void
 output_engine_push (void)
 {
-  struct output_engine *e = xzalloc (sizeof (*e));
+  struct output_engine *e = XZALLOC (struct output_engine);
 
   llx_init (&e->drivers);
 
index 60ca95e28dba029683e895dad42e0a7aac91c2a1..0546e5d3a2eb94612605d9af1e78e9cfb8098215 100644 (file)
@@ -180,9 +180,7 @@ html_create (struct file_handle *fh, enum settings_output_devices device_type,
              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);
index 7fe6555f19dc4acc8f0d16ff3812392f5d9fbbd9..20cfe3a3b2a74384b9073a64bf8ea3daf9881189 100644 (file)
@@ -57,7 +57,6 @@ struct output_driver *
 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 ());
@@ -73,7 +72,7 @@ msglog_create (const char *file_name)
           ? 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;
index a96958b9e8e5d30273cf2a2282402d44272cfc8c..abb30cb530c7c1c85b3edd46afdd825fbe573fe6 100644 (file)
@@ -285,7 +285,6 @@ odt_create (struct file_handle *fh, enum settings_output_devices device_type,
             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);
 
@@ -293,7 +292,7 @@ odt_create (struct file_handle *fh, enum settings_output_devices device_type,
   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);
index 97f51f7604ff4bac4b57912527c95e20fd3f2ee0..0c60b8dc269f39799e2aeeff41825084b318bc97 100644 (file)
@@ -598,7 +598,7 @@ text_item_create_value (enum text_item_subtype subtype,
       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 ()),
index cc541646c86985e58882f1e90d544924983d20f6..6bb446ed8ea5bb2895274a8907e58c88e5caf367 100644 (file)
@@ -865,7 +865,7 @@ pivot_table_create (const char *title)
 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;
@@ -2818,7 +2818,7 @@ struct pivot_value *
 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),
index 249d77f80bf18711aa7b044fc253fc33f7e222c8..b88f10badb7a69779df99ce132dfc31c2a2ee5fa 100644 (file)
@@ -1976,7 +1976,7 @@ static struct render_overflow *
 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]));
index 1eb57f7f16001a6befb951e8817c9010a6b21d94..707e82abfa33afe34348743664bcc176a13a6fce 100644 (file)
@@ -52,9 +52,7 @@ spv_create (struct file_handle *fh, enum settings_output_devices device_type,
             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),
index f5b50e2502849f3a4988e4438bb36a5b73764be0..94d05b59f23e71bf4d89eebbb3fba9355b5dec5d 100644 (file)
@@ -704,7 +704,7 @@ decode_label_frame (struct pivot_table *table,
 
   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++)
         {
@@ -784,7 +784,7 @@ decode_spvdx_source_variable (const struct spvxml_node *node,
                       "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);
@@ -869,7 +869,7 @@ decode_spvdx_derived_variable (const struct spvxml_node *node,
     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;
@@ -959,7 +959,7 @@ pivot_value_from_data_value (const struct spv_data_value *data,
   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)
@@ -1144,7 +1144,7 @@ add_dimension (struct spv_series **series, size_t n,
   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;
@@ -1155,7 +1155,7 @@ add_dimension (struct spv_series **series, size_t n,
     {
       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)
index e58d423d6768f8f98d29ac42ab3fa2a1348eeb23..f1f3dba9607dc68599ceb4a3a755bd471a5754d0 100644 (file)
@@ -291,7 +291,7 @@ decode_spvlb_value (const struct pivot_table *table,
 {
   *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;
@@ -540,7 +540,7 @@ decode_spvlb_categories (const struct pivot_table *table,
       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;
@@ -629,7 +629,7 @@ decode_spvlb_dimension (const struct pivot_table *table,
   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;
@@ -838,7 +838,7 @@ decode_spvlb_table (const struct spvlb_table *in, struct pivot_table **outp)
                       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 ();
index 18f933decc5c5200921678a38075a2e29ce1f771..16f5e365761a12ab3b13cec78ea4d91e42da3bce 100644 (file)
@@ -597,7 +597,7 @@ regexp_destroy (struct comparator *cmptr)
 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;
@@ -617,7 +617,7 @@ static struct comparator *
 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;
@@ -639,7 +639,7 @@ regexp_comparator_create (const struct variable *var, const char *target,
                          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;
index 5ef83fcd2a3e63e216c870446df3a67c029d84fe..eedc21a082d4d6dee0e451c6acf0b6ad6ff328a3 100644 (file)
@@ -120,7 +120,7 @@ choose_likely_separators (PsppireImportAssistant *ia)
 
              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);
index 7a60cce3563fcea8bf360237333fef306af2cb44..46535b0f2362fd7cc8777cdeeaf18a67057c7e9b 100644 (file)
@@ -166,10 +166,9 @@ static struct output_driver_class psppire_output_class =
 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);
index 5a6a8fbd236acc335982f816d5e7d78c8394f74e..b9d9e50c589c9ae0507bdadc575223dc7eac40b2 100644 (file)
@@ -263,13 +263,11 @@ terminal_opts_init (struct argv_parser *ap,
                     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;
index e418ec7e086375f0eb8d6606754595fdc3a23a1c..3225678e8707b28a0dba95064d93fae4abf6b6f0 100644 (file)
@@ -189,12 +189,10 @@ static struct lex_reader_class terminal_reader_class =
 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;