variable: Remove 'aux' member from struct variable.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 2 Jan 2013 02:34:56 +0000 (18:34 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 2 Jan 2013 05:37:35 +0000 (21:37 -0800)
src/data/dictionary.c
src/data/dictionary.h
src/data/variable.c
src/data/variable.h
src/language/command.c

index d36f8c519f5f31437be7f70418f78ae99ce8ed9a..024f97b3d5dd45b5d94d5778582456af30aa19c5 100644 (file)
@@ -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);
 
index d50921201bb8e3d366198997ed223f9134324703..4050756799b7f71591b180cd0ccc04e970b08044 100644 (file)
@@ -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. */
index fe4645ee41e1b7d7fad9042e5dc5014076ace03c..285d9d88f72d90c283db648f0425f055793e1860 100644 (file)
@@ -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);
 }
 \f
-/* 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);
-}
-\f
 /* 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
index aeed5a5e09e14e63e5c2ff73d70009c8b0a0c8c7..aef0d87c5ba78f6420fc1a0d2f637ec599ff1838 100644 (file)
@@ -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 *);
index 0502ff9d00042e473d32d50235aedd4d150d35f1..5b376629d48970ea0c55fae7f6a4707b727d3c1b 100644 (file)
@@ -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;