projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change "union value" to dynamically allocate long strings.
[pspp-builds.git]
/
src
/
language
/
expressions
/
evaluate.c
diff --git
a/src/language/expressions/evaluate.c
b/src/language/expressions/evaluate.c
index a0a133ad66ebd8d483e97e57c86ecf87b5fef6b9..d5f5f3871744252ac9f92ad61ec0e78f9a0b73ad 100644
(file)
--- a/
src/language/expressions/evaluate.c
+++ b/
src/language/expressions/evaluate.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* 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
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
@@
-15,13
+15,13
@@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include "
priv
ate.h"
+#include "
evalu
ate.h"
#include <ctype.h>
#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include <ctype.h>
#include <libpspp/assertion.h>
#include <libpspp/message.h>
-#include
"helpers.h"
-#include
"evaluate.h"
+#include
<language/expressions/helpers.h>
+#include
<language/expressions/private.h>
#include <libpspp/pool.h>
#include "xalloc.h"
#include <libpspp/pool.h>
#include "xalloc.h"
@@
-63,7
+63,7
@@
expr_evaluate (struct expression *e, const struct ccase *c, int case_idx,
break;
case OP_return_number:
break;
case OP_return_number:
- *(double *) result = finite (ns[-1]) ? ns[-1] : SYSMIS;
+ *(double *) result =
is
finite (ns[-1]) ? ns[-1] : SYSMIS;
return;
case OP_return_string:
return;
case OP_return_string:
@@
-98,7
+98,7
@@
expr_evaluate_str (struct expression *e, const struct ccase *c, int case_idx,
assert ((dst == NULL) == (dst_size == 0));
expr_evaluate (e, c, case_idx, &s);
assert ((dst == NULL) == (dst_size == 0));
expr_evaluate (e, c, case_idx, &s);
- buf_copy_rpad (dst, dst_size, s.string, s.length);
+ buf_copy_rpad (dst, dst_size, s.string, s.length
, ' '
);
}
\f
#include <language/lexer/lexer.h>
}
\f
#include <language/lexer/lexer.h>
@@
-170,17
+170,14
@@
cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED)
}
if (c == NULL)
}
if (c == NULL)
- {
- c = xmalloc (sizeof *c);
- case_create (c, dict_get_next_value_idx (d));
- }
+ c = case_create (dict_get_proto (d));
else
else
- c
ase_resize (c, dict_get_next_value_idx
(d));
+ c
= case_unshare_and_resize (c, dict_get_proto
(d));
if (lex_is_number (lexer))
case_data_rw (c, v)->f = lex_tokval (lexer);
else
if (lex_is_number (lexer))
case_data_rw (c, v)->f = lex_tokval (lexer);
else
- memcpy (case_
data_rw (c, v)->s
, ds_data (lex_tokstr (lexer)),
+ memcpy (case_
str_rw (c, v)
, ds_data (lex_tokstr (lexer)),
var_get_width (v));
lex_get (lexer);
var_get_width (v));
lex_get (lexer);
@@
-255,11
+252,7
@@
cmd_debug_evaluate (struct lexer *lexer, struct dataset *dsother UNUSED)
if (ds)
destroy_dataset (ds);
if (ds)
destroy_dataset (ds);
- if (c != NULL)
- {
- case_destroy (c);
- free (c);
- }
+ case_unref (c);
return retval;
}
return retval;
}