short-names: Eliminate use of old hash table data structure.
[pspp-builds.git] / src / data / variable.c
index 056d256720356c1d92686c8e1558fcf6e728953f..ba216f4826eedb93b630375ff62cf7447033ab25 100644 (file)
@@ -199,8 +199,6 @@ var_is_valid_name (const char *name, bool issue_error)
   bool plausible;
   size_t length, i;
 
-  assert (name != NULL);
-
   /* Note that strlen returns number of BYTES, not the number of
      CHARACTERS */
   length = strlen (name);
@@ -246,8 +244,6 @@ var_is_plausible_name (const char *name, bool issue_error)
 {
   size_t length;
 
-  assert (name != NULL);
-
   /* Note that strlen returns number of BYTES, not the number of
      CHARACTERS */
   length = strlen (name);
@@ -849,7 +845,6 @@ var_get_short_name (const struct variable *var, size_t idx)
 void
 var_set_short_name (struct variable *var, size_t idx, const char *short_name)
 {
-  assert (var != NULL);
   assert (short_name == NULL || var_is_plausible_name (short_name, false));
 
   /* Clear old short name numbered IDX, if any. */
@@ -901,7 +896,7 @@ size_t
 var_get_dict_index (const struct variable *v)
 {
   assert (var_has_vardict (v));
-  return v->vardict->dict_index;
+  return vardict_get_dict_index (v->vardict);
 }
 
 /* Returns V's index within the case represented by its
@@ -912,7 +907,7 @@ size_t
 var_get_case_index (const struct variable *v)
 {
   assert (var_has_vardict (v));
-  return v->vardict->case_index;
+  return vardict_get_case_index (v->vardict);
 }
 \f
 /* Returns V's auxiliary data, or a null pointer if none has been
@@ -955,7 +950,6 @@ var_detach_aux (struct variable *v)
 void
 var_clear_aux (struct variable *v)
 {
-  assert (v != NULL);
   if (v->aux != NULL)
     {
       if (v->aux_dtor != NULL)
@@ -1033,7 +1027,9 @@ var_has_attributes (const struct variable *v)
 const char *
 var_get_encoding (const struct variable *var)
 {
-  return var_has_vardict (var) ? dict_get_encoding (var->vardict->dict) : NULL;
+  return (var_has_vardict (var)
+          ? dict_get_encoding (vardict_get_dictionary (var->vardict))
+          : NULL);
 }
 \f
 /* Returns V's vardict structure. */
@@ -1047,9 +1043,6 @@ var_get_vardict (const struct variable *v)
 void
 var_set_vardict (struct variable *v, struct vardict_info *vardict)
 {
-  assert (vardict->dict_index >= 0);
-  assert (vardict->case_index >= 0);
-  assert (vardict->dict != NULL);
   v->vardict = vardict;
 }