projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added fh_free function.
[pspp]
/
src
/
frequencies.q
diff --git
a/src/frequencies.q
b/src/frequencies.q
index 0ca83a45b29e95f866aaedc8d521c81b234ced19..5754be7e61e6de277491488c814ba99af96c2057 100644
(file)
--- a/
src/frequencies.q
+++ b/
src/frequencies.q
@@
-188,7
+188,7
@@
static double scale, incr; /* FIXME */
static int normal; /* FIXME */
/* Variables for which to calculate statistics. */
static int normal; /* FIXME */
/* Variables for which to calculate statistics. */
-static
in
t n_variables;
+static
size_
t n_variables;
static struct variable **v_variables;
/* Arenas used to store semi-permanent storage. */
static struct variable **v_variables;
/* Arenas used to store semi-permanent storage. */
@@
-493,7
+493,7
@@
static int
calc (struct ccase *c, void *aux UNUSED)
{
double weight;
calc (struct ccase *c, void *aux UNUSED)
{
double weight;
-
in
t i;
+
size_
t i;
int bad_warn = 1;
weight = dict_get_case_weight (default_dict, c, &bad_warn);
int bad_warn = 1;
weight = dict_get_case_weight (default_dict, c, &bad_warn);
@@
-547,7
+547,7
@@
calc (struct ccase *c, void *aux UNUSED)
static void
precalc (void *aux UNUSED)
{
static void
precalc (void *aux UNUSED)
{
-
in
t i;
+
size_
t i;
pool_destroy (gen_pool);
gen_pool = pool_create ();
pool_destroy (gen_pool);
gen_pool = pool_create ();
@@
-591,7
+591,7
@@
precalc (void *aux UNUSED)
static void
postcalc (void *aux UNUSED)
{
static void
postcalc (void *aux UNUSED)
{
-
in
t i;
+
size_
t i;
for (i = 0; i < n_variables; i++)
{
for (i = 0; i < n_variables; i++)
{
@@
-720,7
+720,7
@@
postprocess_freq_tab (struct variable *v)
data = hsh_data (ft->data);
/* Copy dereferenced data into freqs. */
data = hsh_data (ft->data);
/* Copy dereferenced data into freqs. */
- freqs = x
malloc (count *
sizeof *freqs);
+ freqs = x
nmalloc (count,
sizeof *freqs);
for (i = 0; i < count; i++)
{
struct freq *f = data[i];
for (i = 0; i < count; i++)
{
struct freq *f = data[i];
@@
-773,8
+773,8
@@
frq_custom_variables (struct cmd_frequencies *cmd UNUSED)
int mode;
int min = 0, max = 0;
int mode;
int min = 0, max = 0;
-
in
t old_n_variables = n_variables;
-
in
t i;
+
size_
t old_n_variables = n_variables;
+
size_
t i;
lex_match ('=');
if (token != T_ALL && (token != T_ID
lex_match ('=');
if (token != T_ALL && (token != T_ID
@@
-835,8
+835,8
@@
frq_custom_variables (struct cmd_frequencies *cmd UNUSED)
{
vf->tab.min = min;
vf->tab.max = max;
{
vf->tab.min = min;
vf->tab.max = max;
- vf->tab.vector = pool_alloc (int_pool,
-
sizeof (struct freq) * (max - min + 1)
);
+ vf->tab.vector = pool_
n
alloc (int_pool,
+
max - min + 1, sizeof *vf->tab.vector
);
}
else
vf->tab.vector = NULL;
}
else
vf->tab.vector = NULL;
@@
-856,14
+856,14
@@
frq_custom_grouped (struct cmd_frequencies *cmd UNUSED)
|| token == T_ID)
for (;;)
{
|| token == T_ID)
for (;;)
{
-
in
t i;
+
size_
t i;
/* Max, current size of list; list itself. */
int nl, ml;
double *dl;
/* Variable list. */
/* Max, current size of list; list itself. */
int nl, ml;
double *dl;
/* Variable list. */
-
in
t n;
+
size_
t n;
struct variable **v;
if (!parse_variables (default_dict, &v, &n,
struct variable **v;
if (!parse_variables (default_dict, &v, &n,
@@
-878,7
+878,7
@@
frq_custom_grouped (struct cmd_frequencies *cmd UNUSED)
if (nl >= ml)
{
ml += 16;
if (nl >= ml)
{
ml += 16;
- dl = pool_
realloc (int_pool, dl, ml * sizeof (double)
);
+ dl = pool_
nrealloc (int_pool, dl, ml, sizeof *dl
);
}
dl[nl++] = tokval;
lex_get ();
}
dl[nl++] = tokval;
lex_get ();
@@
-949,9
+949,8
@@
add_percentile (double x)
if (i >= n_percentiles || tokval != percentiles[i].p)
{
if (i >= n_percentiles || tokval != percentiles[i].p)
{
- percentiles
- = pool_realloc (int_pool, percentiles,
- (n_percentiles + 1) * sizeof (struct percentile ));
+ percentiles = pool_nrealloc (int_pool, percentiles,
+ n_percentiles + 1, sizeof *percentiles);
if (i < n_percentiles)
memmove (&percentiles[i + 1], &percentiles[i],
if (i < n_percentiles)
memmove (&percentiles[i + 1], &percentiles[i],
@@
-1603,7
+1602,7
@@
freq_tab_to_slice_array(const struct freq_tab *frq_tab,
*n_slices = frq_tab->n_valid;
*n_slices = frq_tab->n_valid;
- slices = x
malloc ( *n_slices * sizeof (struct slice )
);
+ slices = x
nmalloc (*n_slices, sizeof *slices
);
for (i = 0 ; i < *n_slices ; ++i )
{
for (i = 0 ; i < *n_slices ; ++i )
{