projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Get rid of superfluous Makefile in src/output/charts.
[pspp-builds.git]
/
src
/
data
/
variable.c
diff --git
a/src/data/variable.c
b/src/data/variable.c
index c0767d7ce245bcfdbcec0b25080228d7c9a38dbc..05edc57e2db85a3c02df4fbe3a16a6747d92c4bc 100644
(file)
--- a/
src/data/variable.c
+++ b/
src/data/variable.c
@@
-149,13
+149,13
@@
var_clone (const struct variable *old_var)
return new_var;
}
return new_var;
}
-/* Create a variable
to be used for internal calculations only.
-
The variable is assigned a unique dictionary index and a cas
e
- index of CASE_IDX. */
+/* Create a variable
of the specified WIDTH to be used for
+
internal calculations only. The variable is assigned a uniqu
e
+
dictionary index and a case
index of CASE_IDX. */
struct variable *
struct variable *
-var_create_internal (int case_idx)
+var_create_internal (int case_idx
, int width
)
{
{
- struct variable *v = var_create ("$internal",
0
);
+ struct variable *v = var_create ("$internal",
width
);
struct vardict_info vdi;
static int counter = INT_MAX / 2;
struct vardict_info vdi;
static int counter = INT_MAX / 2;
@@
-494,7
+494,7
@@
var_is_num_missing (const struct variable *v, double d, enum mv_class class)
S[] must contain exactly as many characters as V's width.
V must be a string variable. */
bool
S[] must contain exactly as many characters as V's width.
V must be a string variable. */
bool
-var_is_str_missing (const struct variable *v, const
char
s[],
+var_is_str_missing (const struct variable *v, const
uint8_t
s[],
enum mv_class class)
{
return mv_is_str_missing (&v->miss, s, class);
enum mv_class class)
{
return mv_is_str_missing (&v->miss, s, class);
@@
-590,10
+590,12
@@
var_append_value_name (const struct variable *v, const union value *value,
struct string *str)
{
const char *name = var_lookup_value_label (v, value);
struct string *str)
{
const char *name = var_lookup_value_label (v, value);
+ const struct dictionary *dict = var_get_vardict (v)->dict;
if (name == NULL)
{
if (name == NULL)
{
- char *s = ds_put_uninit (str, v->print.w);
- data_out (value, &v->print, s);
+ char *s = data_out (value, dict_get_encoding (dict), &v->print);
+ ds_put_cstr (str, s);
+ free (s);
}
else
ds_put_cstr (str, name);
}
else
ds_put_cstr (str, name);
@@
-955,7
+957,7
@@
void *
var_attach_aux (const struct variable *v_,
void *aux, void (*aux_dtor) (struct variable *))
{
var_attach_aux (const struct variable *v_,
void *aux, void (*aux_dtor) (struct variable *))
{
- struct variable *v =
(struct variable *) v_ ; /* cast away const */
+ struct variable *v =
CONST_CAST (struct variable *, v_);
assert (v->aux == NULL);
assert (aux != NULL);
v->aux = aux;
assert (v->aux == NULL);
assert (aux != NULL);
v->aux = aux;
@@
-1013,7
+1015,7
@@
var_get_obs_vals (const struct variable *v)
void
var_set_obs_vals (const struct variable *v_, struct cat_vals *cat_vals)
{
void
var_set_obs_vals (const struct variable *v_, struct cat_vals *cat_vals)
{
- struct variable *v =
(struct variable *) v_ ; /* cast away const */
+ struct variable *v =
CONST_CAST (struct variable *, v_ );
cat_stored_values_destroy (v->obs_vals);
v->obs_vals = cat_vals;
}
cat_stored_values_destroy (v->obs_vals);
v->obs_vals = cat_vals;
}
@@
-1033,7
+1035,7
@@
var_has_obs_vals (const struct variable *v)
struct attrset *
var_get_attributes (const struct variable *v)
{
struct attrset *
var_get_attributes (const struct variable *v)
{
- return
(struct attrset *) &v->attributes
;
+ return
CONST_CAST (struct attrset *, &v->attributes)
;
}
/* Replaces variable V's attributes set by a copy of ATTRS. */
}
/* Replaces variable V's attributes set by a copy of ATTRS. */