projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a79baa2
)
Use XCALLOC / XZALLOC macros where reasonable
author
John Darrington
<john@darrington.wattle.id.au>
Sat, 2 Oct 2021 13:32:40 +0000
(15:32 +0200)
committer
John Darrington
<john@darrington.wattle.id.au>
Sat, 2 Oct 2021 13:32:40 +0000
(15:32 +0200)
19 files changed:
src/language/data-io/matrix-data.c
patch
|
blob
|
history
src/language/stats/chisquare.c
patch
|
blob
|
history
src/language/stats/crosstabs.c
patch
|
blob
|
history
src/language/stats/examine.c
patch
|
blob
|
history
src/language/stats/frequencies.c
patch
|
blob
|
history
src/language/stats/graph.c
patch
|
blob
|
history
src/language/stats/means.c
patch
|
blob
|
history
src/language/stats/median.c
patch
|
blob
|
history
src/language/stats/oneway.c
patch
|
blob
|
history
src/language/stats/regression.c
patch
|
blob
|
history
src/language/stats/reliability.c
patch
|
blob
|
history
src/libpspp/bit-vector.c
patch
|
blob
|
history
src/math/box-whisker.c
patch
|
blob
|
history
src/math/wilcoxon-sig.c
patch
|
blob
|
history
src/output/pivot-output.c
patch
|
blob
|
history
src/output/pivot-table.c
patch
|
blob
|
history
src/output/render.c
patch
|
blob
|
history
src/ui/gui/psppire-import-textfile.c
patch
|
blob
|
history
src/ui/gui/widget-io.c
patch
|
blob
|
history
diff --git
a/src/language/data-io/matrix-data.c
b/src/language/data-io/matrix-data.c
index c0f5979bcd268e215b2930b7e30a60bbfceff332..bffdd92cb7f463d0183181196b9e920f7e1a2fe9 100644
(file)
--- a/
src/language/data-io/matrix-data.c
+++ b/
src/language/data-io/matrix-data.c
@@
-940,7
+940,7
@@
cmd_matrix_data (struct lexer *lexer, struct dataset *ds)
.cells = -1,
};
.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;
if (input_rowtype)
taken_vars[var_get_dict_index (rowtype)] = true;
diff --git
a/src/language/stats/chisquare.c
b/src/language/stats/chisquare.c
index eb21644d4af17b1ec79b88df805cbbe6ea82bdf2..d1d81bab39dcc26e422aa32e96354c5c16a808d5 100644
(file)
--- a/
src/language/stats/chisquare.c
+++ b/
src/language/stats/chisquare.c
@@
-141,8
+141,8
@@
chisquare_execute (const struct dataset *ds,
struct one_sample_test *ost = &cst->parent;
double total_expected = 0.0;
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)
bool ok;
for (i = 0 ; i < cst->n_expected ; ++i)
diff --git
a/src/language/stats/crosstabs.c
b/src/language/stats/crosstabs.c
index 32e1a7736acee63ef52e3d09390f6cb151fe919a..465bdcc278fcab0d806164bad81ad91a23dd12bd 100644
(file)
--- a/
src/language/stats/crosstabs.c
+++ b/
src/language/stats/crosstabs.c
@@
-606,7
+606,7
@@
parse_crosstabs_tables (struct lexer *lexer, struct dataset *ds,
}
}
}
}
- 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++)
proc->pivots = xnrealloc (proc->pivots,
proc->n_pivots + nx, sizeof *proc->pivots);
for (int i = 0; i < nx; i++)
@@
-912,7
+912,7
@@
postcalc (struct crosstabs_proc *proc)
if (proc->barchart)
{
int n_vars = (xt->n_vars > 2 ? 2 : xt->n_vars);
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"),
for (size_t i = 0; i < n_vars; i++)
vars[i] = xt->vars[i].var;
chart_submit (barchart_create (vars, n_vars, _("Count"),
diff --git
a/src/language/stats/examine.c
b/src/language/stats/examine.c
index 00fb801fce273283fc737fc91b2c23aa3531b352..1b668c2b778a5ec49e40e59d85819f097f0aa93d 100644
(file)
--- a/
src/language/stats/examine.c
+++ b/
src/language/stats/examine.c
@@
-1197,13
+1197,12
@@
calculate_n (const void *aux1, void *aux2 UNUSED, void *user_data)
{
const int n_os = 5 + examine->n_percentiles;
{
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;
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);
os[0] = &es[v].trimmed_mean->parent;
es[v].quartiles[0] = percentile_create (0.25, es[v].cc);
@@
-1806,8
+1805,7
@@
cmd_examine (struct lexer *lexer, struct dataset *ds)
if (percentiles_seen && examine.n_percentiles == 0)
{
examine.n_percentiles = 7;
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;
examine.ptiles[0] = 5;
examine.ptiles[1] = 10;
diff --git
a/src/language/stats/frequencies.c
b/src/language/stats/frequencies.c
index 484ce1af1e7095bf2f18e8eef0d6c0ebee16607b..e5462d083d2fd44d6e24e2e23960d360c6ad8f6f 100644
(file)
--- a/
src/language/stats/frequencies.c
+++ b/
src/language/stats/frequencies.c
@@
-631,7
+631,7
@@
cmd_frequencies (struct lexer *lexer, struct dataset *ds)
PV_NO_DUPLICATE))
goto error;
PV_NO_DUPLICATE))
goto error;
- frq.vars = x
zalloc (frq.n_vars *
sizeof (*frq.vars));
+ frq.vars = x
calloc (frq.n_vars,
sizeof (*frq.vars));
for (i = 0; i < frq.n_vars; ++i)
{
frq.vars[i].var = vars[i];
for (i = 0; i < frq.n_vars; ++i)
{
frq.vars[i].var = vars[i];
diff --git
a/src/language/stats/graph.c
b/src/language/stats/graph.c
index 425fd241574d76227d7cb2830dd11aa832307900..2dd98e3db27bbee33f315a0753897280e8797e52 100644
(file)
--- a/
src/language/stats/graph.c
+++ b/
src/language/stats/graph.c
@@
-240,7
+240,7
@@
parse_function (struct lexer *lexer, struct graph *graph)
if (!lex_force_match (lexer, T_LPAREN))
goto error;
if (!lex_force_match (lexer, T_LPAREN))
goto error;
- graph->dep_vars = x
zalloc (sizeof (graph->dep_vars) * graph->n_dep_vars
);
+ graph->dep_vars = x
calloc (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);
for (v = 0; v < ag_func[i].arity; ++v)
{
graph->dep_vars[v] = parse_variable (lexer, graph->dict);
diff --git
a/src/language/stats/means.c
b/src/language/stats/means.c
index 0a3b413df721e7c8ef1f6114a358d1dcc523c885..8ebbca0f355f9babc1dcbb392755e9fa8ba01d65 100644
(file)
--- a/
src/language/stats/means.c
+++ b/
src/language/stats/means.c
@@
-970,10
+970,8
@@
prepare_means (struct means *cmd)
{
struct workspace *ws = mt->ws + i;
ws->root_cell = NULL;
{
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)
{
int cmb = i;
for (int l = mt->n_layers - 1; l >= 0; --l)
{
@@
-1149,9
+1147,9
@@
cmd_means (struct lexer *lexer, struct dataset *ds)
for (int t = 0; t < means.n_tables; ++t)
{
struct mtable *mt = means.table + t;
for (int t = 0; t < means.n_tables; ++t)
{
struct mtable *mt = means.table + t;
- mt->summ = x
zalloc (mt->n_combinations * mt->n_dep_vars
-
*
sizeof (*mt->summ));
- mt->ws = x
zalloc (mt->n_combinations *
sizeof (*mt->ws));
+ mt->summ = x
calloc (mt->n_combinations * mt->n_dep_vars,
+ sizeof (*mt->summ));
+ mt->ws = x
calloc (mt->n_combinations,
sizeof (*mt->ws));
}
run_means (&means, group, ds);
for (int t = 0; t < means.n_tables; ++t)
}
run_means (&means, group, ds);
for (int t = 0; t < means.n_tables; ++t)
diff --git
a/src/language/stats/median.c
b/src/language/stats/median.c
index 8fa38c5a692134506e5c71ff67255ee2c487378d..2e09ab02cef0d21c621d8dbf6b6ca3eca624a47d 100644
(file)
--- a/
src/language/stats/median.c
+++ b/
src/language/stats/median.c
@@
-253,7
+253,7
@@
median_execute (const struct dataset *ds,
}
results[v].n = count;
}
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)
results[v].var = var;
HMAP_FOR_EACH (vn, struct val_node, node, &map)
diff --git
a/src/language/stats/oneway.c
b/src/language/stats/oneway.c
index a61286255674fede14891abce111cd640c2970d5..e20d55198bc1568bdf2432d0a27b5677cc8dcfc9 100644
(file)
--- a/
src/language/stats/oneway.c
+++ b/
src/language/stats/oneway.c
@@
-709,8
+709,8
@@
run_oneway (const struct oneway_spec *cmd,
struct oneway_workspace ws;
ws.actual_number_of_groups = 0;
struct oneway_workspace ws;
ws.actual_number_of_groups = 0;
- ws.vws = x
zalloc (cmd->n_vars *
sizeof (*ws.vws));
- ws.dd_total =
xmalloc (sizeof (struct descriptive_data) * cmd->n_vars
);
+ ws.vws = x
calloc (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]);
for (v = 0 ; v < cmd->n_vars; ++v)
ws.dd_total[v] = dd_create (cmd->vars[v]);
diff --git
a/src/language/stats/regression.c
b/src/language/stats/regression.c
index 7c98dba047b94ca3d278890e68885d08fa48fb71..e08f4a1d76f051b4686f3d4a1b19cd00cee725f7 100644
(file)
--- a/
src/language/stats/regression.c
+++ b/
src/language/stats/regression.c
@@
-671,8
+671,7
@@
run_regression_get_models (const struct regression *cmd,
bool output)
{
size_t i;
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;
struct ccase *c;
struct covariance *cov;
@@
-731,7
+730,7
@@
run_regression_get_models (const struct regression *cmd,
casereader_destroy (r);
}
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++)
{
for (int k = 0; k < cmd->n_dep_vars; k++)
{
diff --git
a/src/language/stats/reliability.c
b/src/language/stats/reliability.c
index 86c1add760eb2faad211df850d53fadd020c28ab..5816a2304ceba846425dab7bf1ab5af3d09ed785 100644
(file)
--- a/
src/language/stats/reliability.c
+++ b/
src/language/stats/reliability.c
@@
-170,13
+170,13
@@
cmd_reliability (struct lexer *lexer, struct dataset *ds)
/* Create a default Scale */
reliability.n_sc = 1;
/* Create a default Scale */
reliability.n_sc = 1;
- reliability.sc = x
zalloc (sizeof (struct cronbach) * reliability.n_sc
);
+ reliability.sc = x
calloc (reliability.n_sc, sizeof (struct cronbach)
);
ds_assign_cstr (&reliability.scale_name, "ANY");
c = &reliability.sc[0];
c->n_items = reliability.n_variables;
ds_assign_cstr (&reliability.scale_name, "ANY");
c = &reliability.sc[0];
c->n_items = reliability.n_variables;
- c->items = x
zalloc (sizeof (struct variable*) * c->n_items
);
+ c->items = x
calloc (c->n_items, sizeof (struct variable*)
);
for (i = 0 ; i < c->n_items ; ++i)
c->items[i] = reliability.variables[i];
for (i = 0 ; i < c->n_items ; ++i)
c->items[i] = reliability.variables[i];
@@
-310,11
+310,8
@@
cmd_reliability (struct lexer *lexer, struct dataset *ds)
(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.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];
for (i = 0; i < reliability.sc[1].n_items ; ++i)
reliability.sc[1].items[i] = s->items[i];
@@
-344,7
+341,7
@@
cmd_reliability (struct lexer *lexer, struct dataset *ds)
struct cronbach *s = &reliability.sc[i + base_sc];
s->n_items = reliability.sc[0].n_items - 1;
struct cronbach *s = &reliability.sc[i + base_sc];
s->n_items = reliability.sc[0].n_items - 1;
- s->items = x
zalloc (sizeof (struct variable *) * s->n_items
);
+ s->items = x
calloc (s->n_items, sizeof (struct variable *)
);
for (v_src = 0 ; v_src < reliability.sc[0].n_items ; ++v_src)
{
if (v_src != i)
for (v_src = 0 ; v_src < reliability.sc[0].n_items ; ++v_src)
{
if (v_src != i)
@@
-391,7
+388,7
@@
run_reliability (struct dataset *ds, const struct reliability *reliability)
struct cronbach *s = &reliability->sc[si];
int i;
struct cronbach *s = &reliability->sc[si];
int i;
- s->m = x
zalloc (sizeof *s->m * s->n_items
);
+ s->m = x
calloc (s->n_items, sizeof *s->m
);
s->total = moments1_create (MOMENT_VARIANCE);
for (i = 0 ; i < s->n_items ; ++i)
s->total = moments1_create (MOMENT_VARIANCE);
for (i = 0 ; i < s->n_items ; ++i)
diff --git
a/src/libpspp/bit-vector.c
b/src/libpspp/bit-vector.c
index 79367248f0ae8653c9463709dc03c4702daa860e..5198c89c216bf94ba14b8e226a9768cd3c303f77 100644
(file)
--- a/
src/libpspp/bit-vector.c
+++ b/
src/libpspp/bit-vector.c
@@
-25,8
+25,7
@@
unsigned long int *
bitvector_allocate(size_t n)
{
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
}
size_t
diff --git
a/src/math/box-whisker.c
b/src/math/box-whisker.c
index 4bbe0f58505d1c60ef407417f0eb53d5b31cdf90..506251682c7bf17106fba7525c2f6dc823ecac1c 100644
(file)
--- a/
src/math/box-whisker.c
+++ b/
src/math/box-whisker.c
@@
-85,7
+85,7
@@
acc (struct statistic *s, const struct ccase *cx,
/* y is an outlier */
/* 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);
o->value = y;
o->extreme = extreme;
ds_init_empty (&o->label);
diff --git
a/src/math/wilcoxon-sig.c
b/src/math/wilcoxon-sig.c
index 17484f1411d51adb170fd431c4b6193dce769f85..a9d9b70dbc9b94c5241365a2cf5580f5b78fd435 100644
(file)
--- a/
src/math/wilcoxon-sig.c
+++ b/
src/math/wilcoxon-sig.c
@@
-93,7
+93,6
@@
count_sums_to_W (unsigned long int n, long int w)
and using int will save some memory on 64-bit systems. */
unsigned long int total;
unsigned long int max;
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));
assert (w >= 0);
assert (n < CHAR_BIT * sizeof (unsigned long int));
@@
-106,7
+105,7
@@
count_sums_to_W (unsigned long int n, long int w)
else if (n == 1)
return 1;
else if (n == 1)
return 1;
-
array = xcalloc (w + 1, sizeof *array
);
+
int *array = XCALLOC (w + 1, int
);
array[w] = 1;
max = w;
array[w] = 1;
max = w;
diff --git
a/src/output/pivot-output.c
b/src/output/pivot-output.c
index a170b6ee71a79e670c72c98fef1bda01c9e97b5a..c3751d04d888dff563b28a1155c18143c64f8b80 100644
(file)
--- a/
src/output/pivot-output.c
+++ b/
src/output/pivot-output.c
@@
-233,7
+233,7
@@
compose_headings (struct table *t,
|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|aaaa1|aaaa2|aaaa3|
+-----+-----+-----+-----+-----+-----+-----+-----+-----+
*/
|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; )
{
vrules[0] = vrules[n_columns] = true;
for (int dim_index = h_axis->n_dimensions; --dim_index >= 0; )
{
@@
-426,7
+426,7
@@
collect_footnotes (const struct pivot_table *pt,
return NULL;
}
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);
size_t n_refs = 0;
add_references (pt, title, refs, &n_refs);
add_references (pt, layers, refs, &n_refs);
diff --git
a/src/output/pivot-table.c
b/src/output/pivot-table.c
index 6bb446ed8ea5bb2895274a8907e58c88e5caf367..f1e0e73372177d1ed566c690523f7b0e1b7bf0dc 100644
(file)
--- a/
src/output/pivot-table.c
+++ b/
src/output/pivot-table.c
@@
-968,7
+968,7
@@
clone_category (struct pivot_category *old,
.extra_depth = old->extra_depth,
.subs = (old->n_subs
.extra_depth = old->extra_depth,
.subs = (old->n_subs
- ? x
zalloc (old->n_subs *
sizeof *new->subs)
+ ? x
calloc (old->n_subs,
sizeof *new->subs)
: NULL),
.n_subs = old->n_subs,
.allocated_subs = old->n_subs,
: NULL),
.n_subs = old->n_subs,
.allocated_subs = old->n_subs,
@@
-1006,9
+1006,9
@@
clone_dimension (struct pivot_dimension *old, struct pivot_table *new_pt)
.axis_type = old->axis_type,
.level = old->level,
.top_index = old->top_index,
.axis_type = old->axis_type,
.level = old->level,
.top_index = old->top_index,
- .data_leaves = x
zalloc (old->n_leaves *
sizeof *new->data_leaves),
- .presentation_leaves = x
z
alloc (old->n_leaves
-
*
sizeof *new->presentation_leaves),
+ .data_leaves = x
calloc (old->n_leaves ,
sizeof *new->data_leaves),
+ .presentation_leaves = x
c
alloc (old->n_leaves
+
,
sizeof *new->presentation_leaves),
.n_leaves = old->n_leaves,
.allocated_leaves = old->n_leaves,
.hide_all_labels = old->hide_all_labels,
.n_leaves = old->n_leaves,
.allocated_leaves = old->n_leaves,
.hide_all_labels = old->hide_all_labels,
diff --git
a/src/output/render.c
b/src/output/render.c
index b88f10badb7a69779df99ce132dfc31c2a2ee5fa..7aa80a6977e69abd92f328429627c22a021e7260 100644
(file)
--- a/
src/output/render.c
+++ b/
src/output/render.c
@@
-539,9
+539,8
@@
render_page_allocate__ (const struct render_params *params,
for (int i = 0; i < TABLE_N_AXES; i++)
{
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);
}
hmap_init (&page->overflows);
@@
-732,7
+731,7
@@
render_page_create (const struct render_params *params, struct table *table,
span multiple columns. */
struct render_row *columns[2];
for (int i = 0; i < 2; i++)
span multiple columns. */
struct render_row *columns[2];
for (int i = 0; i < 2; i++)
- columns[i] = x
zalloc (nc *
sizeof *columns[i]);
+ columns[i] = x
calloc (nc ,
sizeof *columns[i]);
for (int y = 0; y < nr; y++)
for (int x = 0; x < nc;)
{
for (int y = 0; y < nr; y++)
for (int x = 0; x < nc;)
{
@@
-816,7
+815,7
@@
render_page_create (const struct render_params *params, struct table *table,
}
/* Calculate heights of cells that do not span multiple rows. */
}
/* 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;)
{
for (int y = 0; y < nr; y++)
for (int x = 0; x < nc;)
{
diff --git
a/src/ui/gui/psppire-import-textfile.c
b/src/ui/gui/psppire-import-textfile.c
index eedc21a082d4d6dee0e451c6acf0b6ad6ff328a3..d9dcccef2868d11b8d76e475b6ecf38655fe776d 100644
(file)
--- a/
src/ui/gui/psppire-import-textfile.c
+++ b/
src/ui/gui/psppire-import-textfile.c
@@
-88,7
+88,7
@@
choose_likely_separators (PsppireImportAssistant *ia)
gchar *line_text = NULL;
gtk_tree_model_get (GTK_TREE_MODEL (ia->text_file), &iter, 1, &line_text, -1);
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 (;
struct substring cs = ss_cstr (line_text);
for (;
diff --git
a/src/ui/gui/widget-io.c
b/src/ui/gui/widget-io.c
index 9612e44e7f382b05fde510c1a832cc7a7518b1f5..589eac36ebcef4e797ee6fcb02353499bb37c251 100644
(file)
--- a/
src/ui/gui/widget-io.c
+++ b/
src/ui/gui/widget-io.c
@@
-43,7
+43,6
@@
widget_printf (const gchar *fmt, ...)
char_directives d;
arguments a;
GString *output;
char_directives d;
arguments a;
GString *output;
- GtkWidget **widgets;
gchar *text;
va_list ap;
const char *s = fmt;
gchar *text;
va_list ap;
const char *s = fmt;
@@
-51,7
+50,7
@@
widget_printf (const gchar *fmt, ...)
if (0 != printf_parse (fmt, &d, &a))
return NULL;
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)
{
va_start (ap, fmt);
for (i = 0 ; i < d.count ; ++i)
{