From: Ben Pfaff Date: Wed, 2 Jan 2013 02:34:56 +0000 (-0800) Subject: variable: Remove 'aux' member from struct variable. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=0d6dea05bc72a1dae0382bc59577ca642bff898b;p=pspp variable: Remove 'aux' member from struct variable. --- diff --git a/src/data/dictionary.c b/src/data/dictionary.c index d36f8c519f..024f97b3d5 100644 --- a/src/data/dictionary.c +++ b/src/data/dictionary.c @@ -279,17 +279,6 @@ dict_clear (struct dictionary *d) attrset_clear (&d->attributes); } -/* Destroys the aux data for every variable in D, by calling - var_clear_aux() for each variable. */ -void -dict_clear_aux (struct dictionary *d) -{ - int i; - - for (i = 0; i < d->var_cnt; i++) - var_clear_aux (d->var[i].var); -} - /* Clears a dictionary and destroys it. */ void dict_destroy (struct dictionary *d) @@ -600,9 +589,6 @@ dict_delete_var (struct dictionary *d, struct variable *v) assert (dict_contains_var (d, v)); - /* Delete aux data. */ - var_clear_aux (v); - dict_unset_split_var (d, v); dict_unset_mrset_var (d, v); diff --git a/src/data/dictionary.h b/src/data/dictionary.h index d50921201b..4050756799 100644 --- a/src/data/dictionary.h +++ b/src/data/dictionary.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2004, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009, 2010, 2011, 2012 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 @@ -32,7 +32,6 @@ struct dictionary *dict_clone (const struct dictionary *); /* Clearing and destroying dictionaries. */ void dict_clear (struct dictionary *); -void dict_clear_aux (struct dictionary *); void dict_destroy (struct dictionary *); /* Common ways to access variables. */ diff --git a/src/data/variable.c b/src/data/variable.c index fe4645ee41..285d9d88f7 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -72,10 +72,6 @@ struct variable char **short_names; size_t short_name_cnt; - /* Each command may use these fields as needed. */ - void *aux; - void (*aux_dtor) (struct variable *); - /* Custom attributes. */ struct attrset attributes; }; @@ -149,7 +145,6 @@ var_destroy (struct variable *v) assert (!var_has_vardict (v)); mv_destroy (&v->miss); var_clear_short_names (v); - var_clear_aux (v); val_labs_destroy (v->val_labs); var_clear_label (v); attrset_destroy (var_get_attributes (v)); @@ -968,63 +963,6 @@ var_get_case_index (const struct variable *v) return vardict_get_case_index (v->vardict); } -/* Returns V's auxiliary data, or a null pointer if none has been - attached. */ -void * -var_get_aux (const struct variable *v) -{ - return v->aux; -} - -/* Assign auxiliary data AUX to variable V, which must not - already have auxiliary data. Before V's auxiliary data is - cleared, AUX_DTOR(V) will be called. (var_dtor_free, below, - may be appropriate for use as AUX_DTOR.) */ -void * -var_attach_aux (const struct variable *v_, - void *aux, void (*aux_dtor) (struct variable *)) -{ - struct variable *v = CONST_CAST (struct variable *, v_); - assert (v->aux == NULL); - assert (aux != NULL); - v->aux = aux; - v->aux_dtor = aux_dtor; - return aux; -} - -/* Remove auxiliary data, if any, from V, and return it, without - calling any associated destructor. */ -void * -var_detach_aux (struct variable *v) -{ - void *aux = v->aux; - assert (aux != NULL); - v->aux = NULL; - return aux; -} - -/* Clears auxiliary data, if any, from V, and calls any - associated destructor. */ -void -var_clear_aux (struct variable *v) -{ - if (v->aux != NULL) - { - if (v->aux_dtor != NULL) - v->aux_dtor (v); - v->aux = NULL; - } -} - -/* This function is appropriate for use an auxiliary data - destructor (passed as AUX_DTOR to var_attach_aux()) for the - case where the auxiliary data should be passed to free(). */ -void -var_dtor_free (struct variable *v) -{ - free (v->aux); -} - /* Returns variable V's attribute set. The caller may examine or modify the attribute set, but must not destroy it. Destroying V, or calling var_set_attributes() on V, will also destroy its diff --git a/src/data/variable.h b/src/data/variable.h index aeed5a5e09..aef0d87c5b 100644 --- a/src/data/variable.h +++ b/src/data/variable.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012 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 @@ -157,14 +157,6 @@ void var_clear_short_names (struct variable *); size_t var_get_dict_index (const struct variable *); size_t var_get_case_index (const struct variable *); -/* Variable auxiliary data. */ -void *var_get_aux (const struct variable *); -void *var_attach_aux (const struct variable *, - void *aux, void (*aux_dtor) (struct variable *)); -void var_clear_aux (struct variable *); -void *var_detach_aux (struct variable *); -void var_dtor_free (struct variable *); - /* Custom attributes. */ struct attrset *var_get_attributes (const struct variable *); void var_set_attributes (struct variable *, const struct attrset *); diff --git a/src/language/command.c b/src/language/command.c index 0502ff9d00..5b376629d4 100644 --- a/src/language/command.c +++ b/src/language/command.c @@ -138,7 +138,6 @@ cmd_parse_in_state (struct lexer *lexer, struct dataset *ds, ds = session_active_dataset (session); assert (!proc_is_open (ds)); unset_cmd_algorithm (); - dict_clear_aux (dataset_dict (ds)); if (!dataset_end_of_command (ds)) result = CMD_CASCADING_FAILURE;