X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Ft-test-parser.c;h=3ce1d028f9221eba42bca6119f8ffcb64c269ea3;hb=d81e61ee74df11558749faa3ceaf09fda48c7bc1;hp=51f30b9cfcd16a383af8725b8dfd94f685216ea3;hpb=71eea20b080f51f1aa00ef35acf4f49ce742d10a;p=pspp diff --git a/src/language/stats/t-test-parser.c b/src/language/stats/t-test-parser.c index 51f30b9cfc..3ce1d028f9 100644 --- a/src/language/stats/t-test-parser.c +++ b/src/language/stats/t-test-parser.c @@ -48,18 +48,18 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) const struct variable **v2 = NULL; size_t n_v2; - size_t n_pairs; + size_t n_pairs = 0; vp *pairs = NULL; /* One sample mode */ - double testval; + double testval = SYSMIS; /* Independent samples mode */ const struct variable *gvar; union value gval0; union value gval1; - bool cut; + bool cut = false; tt.wv = dict_get_weight (dict); tt.dict = dict; @@ -68,6 +68,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) tt.missing_type = MISS_ANALYSIS; tt.n_vars = 0; tt.vars = NULL; + tt.mode = MODE_undef; lex_match (lexer, T_EQUALS); @@ -128,6 +129,13 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) { bool with = false; bool paired = false; + + if (tt.n_vars > 0) + { + msg (SE, _("VARIABLES subcommand may not be used with PAIRS.")); + goto parse_failed; + } + mode_count++; tt.mode = MODE_PAIRED; lex_match (lexer, T_EQUALS); @@ -170,8 +178,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) else n_pairs = n_v1 * n_v2; - pairs = xcalloc (sizeof *pairs, n_pairs); - + pairs = xcalloc (n_pairs, sizeof *pairs); if ( with) { @@ -290,7 +297,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) if (tt.n_vars == 0 && tt.mode != MODE_PAIRED) { - msg (SE, _("One or more VARIABLES must be specified.")); + lex_sbc_missing ("VARIABLES"); goto parse_failed; }