projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed a lot of non-const pointers to const.
[pspp]
/
src
/
language
/
stats
/
t-test.q
diff --git
a/src/language/stats/t-test.q
b/src/language/stats/t-test.q
index 53136abc5895220e1bb0ef13b2c7cd011062108e..9fd09e7be0c185798de218166ffa23ee1d261b85 100644
(file)
--- a/
src/language/stats/t-test.q
+++ b/
src/language/stats/t-test.q
@@
-110,7
+110,7
@@
static int n_pairs = 0 ;
struct pair
{
/* The variables comprising the pair */
struct pair
{
/* The variables comprising the pair */
- struct variable *v[2];
+
const
struct variable *v[2];
/* The number of valid variable pairs */
double n;
/* The number of valid variable pairs */
double n;
@@
-304,30
+304,29
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
int i;
struct hsh_iterator hi;
int i;
struct hsh_iterator hi;
- struct hsh_table *hash;
- struct variable *v;
+ struct
const_
hsh_table *hash;
+
const
struct variable *v;
- hash = hsh_create (n_pairs, compare_vars_by_name, hash_var_by_name,
+ hash =
const_
hsh_create (n_pairs, compare_vars_by_name, hash_var_by_name,
0, 0);
for (i=0; i < n_pairs; ++i)
{
0, 0);
for (i=0; i < n_pairs; ++i)
{
-
hsh_insert(hash,
pairs[i].v[0]);
-
hsh_insert(hash,
pairs[i].v[1]);
+
const_hsh_insert (hash,
pairs[i].v[0]);
+
const_hsh_insert (hash,
pairs[i].v[1]);
}
assert(cmd.n_variables == 0);
}
assert(cmd.n_variables == 0);
- cmd.n_variables =
hsh_count
(hash);
+ cmd.n_variables =
const_hsh_count
(hash);
cmd.v_variables = xnrealloc (cmd.v_variables, cmd.n_variables,
sizeof *cmd.v_variables);
/* Iterate through the hash */
cmd.v_variables = xnrealloc (cmd.v_variables, cmd.n_variables,
sizeof *cmd.v_variables);
/* Iterate through the hash */
- for (i=0,v =
(struct variable *) hsh_first(hash,
&hi);
+ for (i=0,v =
const_hsh_first (hash,
&hi);
v != 0;
v != 0;
- v
=hsh_next(hash,
&hi) )
+ v
= const_hsh_next (hash,
&hi) )
cmd.v_variables[i++]=v;
cmd.v_variables[i++]=v;
-
- hsh_destroy(hash);
+ const_hsh_destroy(hash);
}
}
else if ( !cmd.sbc_variables)
}
}
else if ( !cmd.sbc_variables)
@@
-441,7
+440,7
@@
tts_custom_groups (struct lexer *lexer, struct dataset *ds, struct cmd_t_test *c
static int
tts_custom_pairs (struct lexer *lexer, struct dataset *ds, struct cmd_t_test *cmd UNUSED, void *aux UNUSED)
{
static int
tts_custom_pairs (struct lexer *lexer, struct dataset *ds, struct cmd_t_test *cmd UNUSED, void *aux UNUSED)
{
- struct variable **vars;
+
const
struct variable **vars;
size_t n_vars;
size_t n_pairs_local;
size_t n_vars;
size_t n_pairs_local;
@@
-452,7
+451,7
@@
tts_custom_pairs (struct lexer *lexer, struct dataset *ds, struct cmd_t_test *cm
lex_match (lexer, '=');
n_vars=0;
lex_match (lexer, '=');
n_vars=0;
- if (!parse_variables (lexer, dataset_dict (ds), &vars, &n_vars,
+ if (!parse_variables
_const
(lexer, dataset_dict (ds), &vars, &n_vars,
PV_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH))
{
free (vars);
PV_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH))
{
free (vars);
@@
-464,7
+463,7
@@
tts_custom_pairs (struct lexer *lexer, struct dataset *ds, struct cmd_t_test *cm
if (lex_match (lexer, T_WITH))
{
n_before_WITH = n_vars;
if (lex_match (lexer, T_WITH))
{
n_before_WITH = n_vars;
- if (!parse_variables (lexer, dataset_dict (ds), &vars, &n_vars,
+ if (!parse_variables
_const
(lexer, dataset_dict (ds), &vars, &n_vars,
PV_DUPLICATE | PV_APPEND
| PV_NUMERIC | PV_NO_SCRATCH))
{
PV_DUPLICATE | PV_APPEND
| PV_NUMERIC | PV_NO_SCRATCH))
{
@@
-485,7
+484,7
@@
tts_custom_pairs (struct lexer *lexer, struct dataset *ds, struct cmd_t_test *cm
msg (SE, _("PAIRED was specified but the number of variables "
"preceding WITH (%d) did not match the number "
"following (%d)."),
msg (SE, _("PAIRED was specified but the number of variables "
"preceding WITH (%d) did not match the number "
"following (%d)."),
-
n_before_WITH,
n_after_WITH );
+
(int) n_before_WITH, (int)
n_after_WITH );
return 0;
}
n_pairs_local = n_before_WITH;
return 0;
}
n_pairs_local = n_before_WITH;
@@
-749,7
+748,7
@@
ssbox_independent_samples_populate(struct ssbox *ssb,
for (i=0; i < cmd->n_variables; ++i)
{
for (i=0; i < cmd->n_variables; ++i)
{
- struct variable *var = cmd->v_variables[i];
+
const
struct variable *var = cmd->v_variables[i];
struct hsh_table *grp_hash = group_proc_get (var)->group_hash;
int count=0;
struct hsh_table *grp_hash = group_proc_get (var)->group_hash;
int count=0;
@@
-1012,7
+1011,7
@@
trbox_independent_samples_populate(struct trbox *self,
double std_err_diff;
double mean_diff;
double std_err_diff;
double mean_diff;
- struct variable *var = cmd->v_variables[i];
+
const
struct variable *var = cmd->v_variables[i];
struct group_proc *grp_data = group_proc_get (var);
struct hsh_table *grp_hash = grp_data->group_hash;
struct group_proc *grp_data = group_proc_get (var);
struct hsh_table *grp_hash = grp_data->group_hash;
@@
-1429,7
+1428,7
@@
common_calc (const struct dictionary *dict,
for(i = 0; i < cmd->n_variables ; ++i)
{
for(i = 0; i < cmd->n_variables ; ++i)
{
- struct variable *v = cmd->v_variables[i];
+
const
struct variable *v = cmd->v_variables[i];
if (! casefilter_variable_missing (filter, c, v) )
{
if (! casefilter_variable_missing (filter, c, v) )
{
@@
-1505,7
+1504,7
@@
one_sample_calc (const struct dictionary *dict,
for(i=0; i< cmd->n_variables ; ++i)
{
struct group_statistics *gs;
for(i=0; i< cmd->n_variables ; ++i)
{
struct group_statistics *gs;
- struct variable *v = cmd->v_variables[i];
+
const
struct variable *v = cmd->v_variables[i];
const union value *val = case_data (c, v);
gs= &group_proc_get (cmd->v_variables[i])->ugs;
const union value *val = case_data (c, v);
gs= &group_proc_get (cmd->v_variables[i])->ugs;
@@
-1578,8
+1577,8
@@
paired_calc (const struct dictionary *dict, const struct ccase *c,
for(i=0; i < n_pairs ; ++i )
{
for(i=0; i < n_pairs ; ++i )
{
- struct variable *v0 = pairs[i].v[0];
- struct variable *v1 = pairs[i].v[1];
+
const
struct variable *v0 = pairs[i].v[0];
+
const
struct variable *v1 = pairs[i].v[1];
const union value *val0 = case_data (c, v0);
const union value *val1 = case_data (c, v1);
const union value *val0 = case_data (c, v0);
const union value *val1 = case_data (c, v1);
@@
-1711,7
+1710,7
@@
group_calc (const struct dictionary *dict,
for(i=0; i< cmd->n_variables ; ++i)
{
for(i=0; i< cmd->n_variables ; ++i)
{
- struct variable *var = cmd->v_variables[i];
+
const
struct variable *var = cmd->v_variables[i];
const union value *val = case_data (c, var);
struct hsh_table *grp_hash = group_proc_get (var)->group_hash;
struct group_statistics *gs;
const union value *val = case_data (c, var);
struct hsh_table *grp_hash = group_proc_get (var)->group_hash;
struct group_statistics *gs;
@@
-1742,7
+1741,7
@@
group_postcalc ( struct cmd_t_test *cmd )
for (i = 0; i < cmd->n_variables ; ++i)
{
for (i = 0; i < cmd->n_variables ; ++i)
{
- struct variable *var = cmd->v_variables[i];
+
const
struct variable *var = cmd->v_variables[i];
struct hsh_table *grp_hash = group_proc_get (var)->group_hash;
struct hsh_iterator g;
struct group_statistics *gs;
struct hsh_table *grp_hash = group_proc_get (var)->group_hash;
struct hsh_iterator g;
struct group_statistics *gs;
@@
-1785,7
+1784,8
@@
calculate(const struct ccase *first, const struct casefile *cf,
struct cmd_t_test *cmd = (struct cmd_t_test *) cmd_;
struct cmd_t_test *cmd = (struct cmd_t_test *) cmd_;
- struct casefilter *filter = casefilter_create (cmd->miss != TTS_INCLUDE,
+ struct casefilter *filter = casefilter_create ((cmd->miss != TTS_INCLUDE
+ ? MV_ANY : MV_SYSTEM),
NULL, 0);
if ( cmd->miss == TTS_LISTWISE )
NULL, 0);
if ( cmd->miss == TTS_LISTWISE )