X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fexpressions%2Fevaluate.c;h=91b9c84249b76c0e7d799ad7dc089f66874c314a;hb=7fbfc32fc3c636959b0a25b3e76609f86519e84a;hp=6e3315c385a40ad45206ef2d6f5bc2880b2b795b;hpb=43b1296aafe7582e7dbe6c2b6a8b478d7d9b0fcf;p=pspp-builds.git diff --git a/src/language/expressions/evaluate.c b/src/language/expressions/evaluate.c index 6e3315c3..91b9c842 100644 --- a/src/language/expressions/evaluate.c +++ b/src/language/expressions/evaluate.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,13 +18,14 @@ #include "private.h" #include -#include #include #include #include "helpers.h" #include "evaluate.h" #include +#include "xalloc.h" + static void expr_evaluate (struct expression *e, const struct ccase *c, int case_idx, void *result) @@ -62,7 +63,7 @@ expr_evaluate (struct expression *e, const struct ccase *c, int case_idx, break; case OP_return_number: - *(double *) result = finite (ns[-1]) ? ns[-1] : SYSMIS; + *(double *) result = isfinite (ns[-1]) ? ns[-1] : SYSMIS; return; case OP_return_string: @@ -125,7 +126,7 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) dump_postfix = 1; else if (lex_match (lexer, '(')) { - char name[LONG_NAME_LEN + 1]; + char name[VAR_NAME_LEN + 1]; struct variable *v; size_t old_value_cnt; int width; @@ -156,7 +157,7 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) if ( ds == NULL ) { - ds = create_dataset (NULL, NULL); + ds = create_dataset (); d = dataset_dict (ds); } @@ -169,12 +170,9 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) } if (c == NULL) - { - c = xmalloc (sizeof *c); - case_create (c, dict_get_next_value_idx (d)); - } + c = case_create (dict_get_next_value_idx (d)); else - case_resize (c, dict_get_next_value_idx (d)); + c = case_resize (c, dict_get_next_value_idx (d)); if (lex_is_number (lexer)) case_data_rw (c, v)->f = lex_tokval (lexer); @@ -254,11 +252,7 @@ cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED) if (ds) destroy_dataset (ds); - if (c != NULL) - { - case_destroy (c); - free (c); - } + case_unref (c); return retval; }